diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-04-07 16:28:09 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-04-07 16:28:09 +0000 |
commit | 27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7 (patch) | |
tree | d91c99e57babfeaf64a8d686fdadd935a0c50866 /stdlib | |
parent | 6ca96fe202d5031bd34794b81798651a07839075 (diff) | |
download | glibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.zip glibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.tar.gz glibc-27a5bb33ac41b838dd3c4ebdc3a75a6ad666dfc7.tar.bz2 |
Update.
1998-04-07 16:18 Ulrich Drepper <drepper@cygnus.com>
* libc.map: Add __asprintf to GLIBC_2.1.
* elf/dlerror.c: Use __asprintf, not asprintf.
* libio/stdio.h: Declare __asprintf.
* stdio-common/asprintf.c: Define as __asprintf and make asprintf
a weak alias.
* elf/dl-minimal.c: Add definition of strtol and strtoul (und friends)
to avoid inclusion from libc_pic.a.
* elf/dl-runtime.c: Undo last patch.
* stdlib/strtod.c: Don't use mbtowc, use btowc.
* sysdeps/i386/dl-machine.h (dl_platform_init): Don't use "i386"
as default, use NULL.
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/strtod.c | 19 | ||||
-rw-r--r-- | stdlib/strtol.c | 48 |
2 files changed, 34 insertions, 33 deletions
diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 061cedc..a06239d 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -88,10 +88,12 @@ # define LOCALE_PARAM_DECL #endif +#if defined _LIBC || defined HAVE_WCHAR_H +# include <wchar.h> +#endif #ifdef USE_WIDE_CHAR # include <wctype.h> -# include <wchar.h> # define STRING_TYPE wchar_t # define CHAR_TYPE wint_t # define L_(Ch) L##Ch @@ -440,7 +442,7 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM) /* The radix character of the current locale. */ wchar_t decimal; /* The thousands character of the current locale. */ - wchar_t thousands; + wchar_t thousands = L'\0'; /* The numeric grouping specification of the current locale, in the format described in <locale.h>. */ const char *grouping; @@ -457,18 +459,17 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM) else { /* Figure out the thousands separator character. */ - if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP), - strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0) - thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); +#if defined _LIBC || defined _HAVE_BTOWC + thousands = btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); + if (thousands == WEOF) + thousands = L'\0'; +#endif if (thousands == L'\0') grouping = NULL; } } else - { - grouping = NULL; - thousands = L'\0'; - } + grouping = NULL; /* Find the locale's decimal point character. */ if (mbtowc ((wchar_t *) &decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT), diff --git a/stdlib/strtol.c b/stdlib/strtol.c index 19e4a52..e4e7b4e 100644 --- a/stdlib/strtol.c +++ b/stdlib/strtol.c @@ -1,5 +1,5 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -167,9 +167,11 @@ extern int errno; # define LOCALE_PARAM_DECL #endif +#if defined _LIBC || defined HAVE_WCHAR_H +# include <wchar.h> +#endif #ifdef USE_WIDE_CHAR -# include <wchar.h> # include <wctype.h> # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t @@ -247,7 +249,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) struct locale_data *current = loc->__locales[LC_NUMERIC]; # endif /* The thousands character of the current locale. */ - wchar_t thousands; + wchar_t thousands = L'\0'; /* The numeric grouping specification of the current locale, in the format described in <locale.h>. */ const char *grouping; @@ -260,9 +262,11 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) else { /* Figure out the thousands separator character. */ - if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP), - strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0) - thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); +# if defined _LIBC || defined _HAVE_BTOWC + thousands = btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); + if (thousands == WEOF) + thousands = L'\0'; +# endif if (thousands == L'\0') grouping = NULL; } @@ -299,23 +303,19 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) else negative = 0; - if (base == 16 && s[0] == L_('0') && TOUPPER (s[1]) == L_('X')) - s += 2; - - /* If BASE is zero, figure it out ourselves. */ - if (base == 0) - if (*s == L_('0')) - { - if (TOUPPER (s[1]) == L_('X')) - { - s += 2; - base = 16; - } - else - base = 8; - } - else - base = 10; + /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ + if (*s == L_('0')) + { + if (TOUPPER (s[1]) == L_('X')) + { + s += 2; + base = 16; + } + else if (base == 0) + base = 8; + } + else if (base == 0) + base = 10; /* Save the pointer so we can check later if anything happened. */ save = s; @@ -396,7 +396,7 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) } /* Return the result of the appropriate sign. */ - return (negative ? -i : i); + return negative ? -i : i; noconv: /* We must handle a special case here: the base is 0 or 16 and the |