diff options
author | ache <ache@FreeBSD.org> | 2001-02-10 03:31:23 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-02-10 03:31:23 +0000 |
commit | 3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685 (patch) | |
tree | d5d50c4b5568efb0d45a609f8935f397982446e9 /lib/libc/locale | |
parent | 42a3debfe346a42152afc07a0ea592e455948062 (diff) | |
download | FreeBSD-src-3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685.zip FreeBSD-src-3e4ec8e5b21f8d6fc42e74f11bd47efc7127e685.tar.gz |
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()
Diffstat (limited to 'lib/libc/locale')
-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 3db39fa..715790e 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 60949b0..0de5a32 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 6e62388..24ff28f 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; } /* |