diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-02-10 03:31:23 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-02-10 03:31:23 +0000 |
commit | 96be743f8021a399b705c79cbf1b6cb939e529f4 (patch) | |
tree | 7a09069ecfc3a602135965fe2ca44bbe0ecd3965 | |
parent | 87b110d6363e08d85206b63f0f975bf242aae06d (diff) | |
download | src-96be743f8021a399b705c79cbf1b6cb939e529f4.tar.gz src-96be743f8021a399b705c79cbf1b6cb939e529f4.zip |
According to Garrett, POSIX widely use -1 to indicate CHAR_MAX, so back out
all my "-1" -> "something" fixes and replace -1 with CHAR_MAX directly in
strtol() in cnv()
Notes
Notes:
svn path=/head/; revision=72283
-rw-r--r-- | lib/libc/locale/lmonetary.c | 4 | ||||
-rw-r--r-- | lib/libc/locale/lnumeric.c | 4 | ||||
-rw-r--r-- | lib/libc/locale/localeconv.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c index 3db39fac26a0..715790e72656 100644 --- a/lib/libc/locale/lmonetary.c +++ b/lib/libc/locale/lmonetary.c @@ -26,8 +26,6 @@ * $FreeBSD$ */ -#include <limits.h> -#include <sys/cdefs.h> #include "lmonetary.h" #include "ldpart.h" @@ -36,7 +34,7 @@ extern int __mlocale_changed; #define LCMONETARY_SIZE (sizeof(struct lc_monetary_T) / sizeof(char *)) static char empty[] = ""; -static char numempty[] = __XSTRING(CHAR_MAX); +static char numempty[] = "-1"; static const struct lc_monetary_T _C_monetary_locale = { empty , /* int_curr_symbol */ diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c index 60949b0abf3e..0de5a323ba8a 100644 --- a/lib/libc/locale/lnumeric.c +++ b/lib/libc/locale/lnumeric.c @@ -26,8 +26,6 @@ * $FreeBSD$ */ -#include <limits.h> -#include <sys/cdefs.h> #include "lnumeric.h" #include "ldpart.h" @@ -35,7 +33,7 @@ extern int __nlocale_changed; #define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *)) -static char numempty[] = __XSTRING(CHAR_MAX); +static char numempty[] = "-1"; static const struct lc_numeric_T _C_numeric_locale = { ".", /* decimal_point */ diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c index 6e6238807286..24ff28f7fe60 100644 --- a/lib/libc/locale/localeconv.c +++ b/lib/libc/locale/localeconv.c @@ -34,6 +34,7 @@ static char rcsid[] = "$FreeBSD$"; #include <locale.h> #include <stdlib.h> +#include <limits.h> #include "lmonetary.h" #include "lnumeric.h" @@ -51,7 +52,10 @@ int __nlocale_changed = 1; static char cnv(char *str) { - return (char)strtol(str, NULL, 0); + int i = strtol(str, NULL, 10); + if (i == -1) + i = CHAR_MAX; + return (char)i; } /* |