diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/stdlib.h | 22 | ||||
-rw-r--r-- | stdlib/strfmon_l.c | 4 | ||||
-rw-r--r-- | stdlib/strtod_l.c | 54 | ||||
-rw-r--r-- | stdlib/strtol_l.c | 4 |
4 files changed, 45 insertions, 39 deletions
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index dc51d67170..8669f35d76 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1991-2007, 2009, 2010 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 @@ -37,7 +37,7 @@ __BEGIN_DECLS #ifndef __need_malloc_and_calloc #define _STDLIB_H 1 -#if defined __USE_XOPEN && !defined _SYS_WAIT_H +#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H /* XPG requires a few symbols from <sys/wait.h> being defined. */ # include <bits/waitflags.h> # include <bits/waitstatus.h> @@ -91,7 +91,7 @@ typedef union # ifdef __WIFCONTINUED # define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status)) # endif -#endif /* X/Open and <sys/wait.h> not included. */ +#endif /* X/Open or XPG7 and <sys/wait.h> not included. */ __BEGIN_NAMESPACE_STD /* Returned by `div'. */ @@ -497,7 +497,8 @@ extern void cfree (void *__ptr) __THROW; # include <alloca.h> #endif /* Use GNU, BSD, or misc. */ -#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \ + && !defined __USE_XOPEN2K /* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur; #endif @@ -596,13 +597,17 @@ extern int clearenv (void) __THROW; #endif -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \ + && !defined __USE_XOPEN2K /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; +#endif +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ + || defined __USE_XOPEN2K8 /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the filename unique. @@ -792,7 +797,8 @@ __END_NAMESPACE_C99 #endif -#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED +#if (defined __USE_SVID || defined __USE_XOPEN_EXTENDED) \ + && !defined __USE_XOPEN2K /* Convert floating point numbers to strings. The returned values are valid only until another call to the same function. */ @@ -880,7 +886,7 @@ extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur; #endif -#ifdef __USE_XOPEN_EXTENDED +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Parse comma separated suboption from *OPTIONP and match against strings in TOKENS. If found return index and set *VALUEP to optional value introduced by an equal sign. If the suboption is @@ -902,7 +908,7 @@ extern void setkey (__const char *__key) __THROW __nonnull ((1)); /* X/Open pseudo terminal handling. */ -#ifdef __USE_XOPEN2K +#ifdef __USE_XOPEN2KXSI /* Return a master pseudo-terminal handle. */ extern int posix_openpt (int __oflag) __wur; #endif diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c index eb7a17801a..7642753cb1 100644 --- a/stdlib/strfmon_l.c +++ b/stdlib/strfmon_l.c @@ -1,5 +1,5 @@ /* Formatting a monetary value according to the given locale. - Copyright (C) 1996,1997,2002,2004,2006,2009 Free Software Foundation, Inc. + Copyright (C) 1996,1997,2002,2004,2006,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -88,7 +88,7 @@ ssize_t __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, va_list ap) { - struct locale_data *current = loc->__locales[LC_MONETARY]; + struct __locale_data *current = loc->__locales[LC_MONETARY]; _IO_strfile f; struct printf_info info; char *dest; /* Pointer so copy the output. */ diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 9ddfa3fa66..cde1280e55 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to float value, using given locale. - Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009 + Copyright (C) 1997,1998,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -214,15 +214,15 @@ round_and_return (mp_limb_t *retval, int exponent, int negative, != 0); (void) __mpn_rshift (retval, &retval[shift / BITS_PER_MP_LIMB], - RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB), - shift % BITS_PER_MP_LIMB); - MPN_ZERO (&retval[RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB)], - shift / BITS_PER_MP_LIMB); + RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB), + shift % BITS_PER_MP_LIMB); + MPN_ZERO (&retval[RETURN_LIMB_SIZE - (shift / BITS_PER_MP_LIMB)], + shift / BITS_PER_MP_LIMB); } else if (shift > 0) { - round_limb = retval[0]; - round_bit = shift - 1; + round_limb = retval[0]; + round_bit = shift - 1; (void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, shift); } /* This is a hook for the m68k long double format, where the @@ -237,14 +237,14 @@ round_and_return (mp_limb_t *retval, int exponent, int negative, if ((round_limb & (((mp_limb_t) 1) << round_bit)) != 0 && (more_bits || (retval[0] & 1) != 0 - || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0)) + || (round_limb & ((((mp_limb_t) 1) << round_bit) - 1)) != 0)) { mp_limb_t cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1); if (((MANT_DIG % BITS_PER_MP_LIMB) == 0 && cy) || - ((MANT_DIG % BITS_PER_MP_LIMB) != 0 && - (retval[RETURN_LIMB_SIZE - 1] - & (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0)) + ((MANT_DIG % BITS_PER_MP_LIMB) != 0 && + (retval[RETURN_LIMB_SIZE - 1] + & (((mp_limb_t) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0)) { ++exponent; (void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, 1); @@ -465,7 +465,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) /* Used in several places. */ int cnt; - struct locale_data *current = loc->__locales[LC_NUMERIC]; + struct __locale_data *current = loc->__locales[LC_NUMERIC]; if (__builtin_expect (group, 0)) { @@ -738,7 +738,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) grouping); #endif if (cp != tp) - { + { /* Less than the entire string was correctly grouped. */ if (tp == start_of_digits) @@ -1113,14 +1113,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) memcpy (retval, &num[least_idx], RETURN_LIMB_SIZE * sizeof (mp_limb_t)); else - { - for (i = least_idx; i < numsize - 1; ++i) - retval[i - least_idx] = (num[i] >> least_bit) - | (num[i + 1] - << (BITS_PER_MP_LIMB - least_bit)); - if (i - least_idx < RETURN_LIMB_SIZE) - retval[RETURN_LIMB_SIZE - 1] = num[i] >> least_bit; - } + { + for (i = least_idx; i < numsize - 1; ++i) + retval[i - least_idx] = (num[i] >> least_bit) + | (num[i + 1] + << (BITS_PER_MP_LIMB - least_bit)); + if (i - least_idx < RETURN_LIMB_SIZE) + retval[RETURN_LIMB_SIZE - 1] = num[i] >> least_bit; + } /* Check whether any limb beside the ones in RETVAL are non-zero. */ for (i = 0; num[i] == 0; ++i) @@ -1174,7 +1174,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) #if RETURN_LIMB_SIZE > 1 if (numsize < RETURN_LIMB_SIZE) # if RETURN_LIMB_SIZE == 2 - retval[numsize] = 0; + retval[numsize] = 0; # else MPN_ZERO (retval + numsize, RETURN_LIMB_SIZE - numsize); # endif @@ -1201,14 +1201,14 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) /* For the fractional part we need not process too many digits. One decimal digits gives us log_2(10) ~ 3.32 bits. If we now compute - ceil(BITS / 3) =: N + ceil(BITS / 3) =: N digits we should have enough bits for the result. The remaining decimal digits give us the information that more bits are following. This can be used while rounding. (Two added as a safety margin.) */ if (dig_no - int_no > (MANT_DIG - bits + 2) / 3 + 2) { - dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2; - more_bits = 1; + dig_no = int_no + (MANT_DIG - bits + 2) / 3 + 2; + more_bits = 1; } else more_bits = 0; @@ -1264,9 +1264,9 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc) digits. This is done by a "quasi fix point" number representation. num: ddddddddddd . 0000000000000000000000 - |--- m ---| + |--- m ---| den: ddddddddddd n >= m - |--- n ---| + |--- n ---| */ count_leading_zeros (cnt, den[densize - 1]); diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c index ba0aba7919..9181bf10ee 100644 --- a/stdlib/strtol_l.c +++ b/stdlib/strtol_l.c @@ -1,5 +1,5 @@ /* Convert string representing a number to integer value, using given locale. - Copyright (C) 1997, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1997, 2002, 2004, 2006, 2007, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -243,7 +243,7 @@ INTERNAL (__strtol_l) (nptr, endptr, base, group, loc) #endif #ifdef USE_NUMBER_GROUPING - struct locale_data *current = loc->__locales[LC_NUMERIC]; + struct __locale_data *current = loc->__locales[LC_NUMERIC]; /* The thousands character of the current locale. */ # ifdef USE_WIDE_CHAR wchar_t thousands = L'\0'; |