diff options
author | ache <ache@FreeBSD.org> | 2001-12-30 03:34:46 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-12-30 03:34:46 +0000 |
commit | a6e7c78be57ebd99da59ac7e960f115badce24fd (patch) | |
tree | 4aa0c4f3355219f0fd3e65a25e922b69f3f9523e /lib/libc/stdlib | |
parent | c79d7cebd4c6fd0a4f8f8e633c5e25ead4f5213e (diff) | |
download | FreeBSD-src-a6e7c78be57ebd99da59ac7e960f115badce24fd.zip FreeBSD-src-a6e7c78be57ebd99da59ac7e960f115badce24fd.tar.gz |
Back out errno preserving
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/atof.3 | 6 | ||||
-rw-r--r-- | lib/libc/stdlib/atof.c | 9 | ||||
-rw-r--r-- | lib/libc/stdlib/atoi.3 | 6 | ||||
-rw-r--r-- | lib/libc/stdlib/atoi.c | 8 | ||||
-rw-r--r-- | lib/libc/stdlib/atol.3 | 12 | ||||
-rw-r--r-- | lib/libc/stdlib/atol.c | 9 | ||||
-rw-r--r-- | lib/libc/stdlib/atoll.c | 9 |
7 files changed, 12 insertions, 47 deletions
diff --git a/lib/libc/stdlib/atof.3 b/lib/libc/stdlib/atof.3 index ad865f4..6ae9846 100644 --- a/lib/libc/stdlib/atof.3 +++ b/lib/libc/stdlib/atof.3 @@ -64,8 +64,6 @@ It is equivalent to: strtod(nptr, (char **)NULL); .Ed .Pp -except the handling of errors. -.Pp The decimal point character is defined in the program's locale (category .Dv LC_NUMERIC ) . @@ -80,9 +78,9 @@ function has been deprecated by .Fn strtod and should not be used in new code. .Sh ERRORS -The +The function .Fn atof -function does not detect errors. +need not affect the value of errno on an error. .Sh SEE ALSO .Xr atoi 3 , .Xr atol 3 , diff --git a/lib/libc/stdlib/atof.c b/lib/libc/stdlib/atof.c index e6dffa9..0de674f 100644 --- a/lib/libc/stdlib/atof.c +++ b/lib/libc/stdlib/atof.c @@ -37,18 +37,11 @@ static char sccsid[] = "@(#)atof.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include <errno.h> #include <stdlib.h> double atof(ascii) const char *ascii; { - double r; - int saverr; - - saverr = errno; - r = strtod(ascii, (char **)NULL); - errno = saverr; - return r; + return strtod(ascii, (char **)NULL); } diff --git a/lib/libc/stdlib/atoi.3 b/lib/libc/stdlib/atoi.3 index 551fc56..360faf7 100644 --- a/lib/libc/stdlib/atoi.3 +++ b/lib/libc/stdlib/atoi.3 @@ -63,8 +63,6 @@ It is equivalent to: .Bd -literal -offset indent (int)strtol(nptr, (char **)NULL, 10); .Ed -.Pp -except the handling of errors. .Sh IMPLEMENTATION NOTES The .Fn atoi @@ -76,9 +74,9 @@ function has been deprecated by .Fn strtol and should not be used in new code. .Sh ERRORS -The +The function .Fn atoi -function does not detect errors. +need not affect the value of errno on an error. .Sh SEE ALSO .Xr atof 3 , .Xr atol 3 , diff --git a/lib/libc/stdlib/atoi.c b/lib/libc/stdlib/atoi.c index 8e98a96e7..17c91c1 100644 --- a/lib/libc/stdlib/atoi.c +++ b/lib/libc/stdlib/atoi.c @@ -37,17 +37,11 @@ static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include <errno.h> #include <stdlib.h> int atoi(str) const char *str; { - int r, saverr; - - saverr = errno; - r = (int)strtol(str, (char **)NULL, 10); - errno = saverr; - return r; + return (int)strtol(str, (char **)NULL, 10); } diff --git a/lib/libc/stdlib/atol.3 b/lib/libc/stdlib/atol.3 index 261999f..0dceeec 100644 --- a/lib/libc/stdlib/atol.3 +++ b/lib/libc/stdlib/atol.3 @@ -70,8 +70,6 @@ It is equivalent to: .Pp .Dl "strtol(nptr, (char **)NULL, 10);" .Pp -except the handling of errors. -.Pp The .Fn atoll function converts the initial portion of the string pointed to by @@ -84,15 +82,13 @@ representation. It is equivalent to: .Pp .Dl "strtoll(nptr, (char **)NULL, 10);" -.Pp -except the handling of errors. .Sh ERRORS -The +The functions .Fn atol -function does not detect errors. -The +and .Fn atoll -function does not detect errors. +need not +affect the value of errno on an error. .Sh SEE ALSO .Xr atof 3 , .Xr atoi 3 , diff --git a/lib/libc/stdlib/atol.c b/lib/libc/stdlib/atol.c index b85b8b2..d2e3c45 100644 --- a/lib/libc/stdlib/atol.c +++ b/lib/libc/stdlib/atol.c @@ -37,18 +37,11 @@ static char sccsid[] = "@(#)atol.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include <errno.h> #include <stdlib.h> long atol(str) const char *str; { - long r; - int saverr; - - saverr = errno; - r = strtol(str, (char **)NULL, 10); - errno = saverr; - return r; + return strtol(str, (char **)NULL, 10); } diff --git a/lib/libc/stdlib/atoll.c b/lib/libc/stdlib/atoll.c index c0a7212..a3c15a2 100644 --- a/lib/libc/stdlib/atoll.c +++ b/lib/libc/stdlib/atoll.c @@ -33,18 +33,11 @@ * $FreeBSD$ */ -#include <errno.h> #include <stdlib.h> long long atoll(str) const char *str; { - long long r; - int saverr; - - saverr = errno; - r = strtoll(str, (char **)NULL, 10); - errno = saverr; - return r; + return strtoll(str, (char **)NULL, 10); } |