mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 14:30:06 +00:00
Portability changes from Uli Drepper. [!STDC_HEADERS && !defined(NULL)] Define NULL.
This commit is contained in:
parent
787429e3f0
commit
e09675ddfb
@ -17,13 +17,30 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "../locale/localeinfo.h"
|
||||
#else
|
||||
# ifndef NULL
|
||||
# define NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBC
|
||||
# define USE_NUMBER_GROUPING
|
||||
#endif
|
||||
|
||||
#ifdef USE_NUMBER_GROUPING
|
||||
# include "../locale/localeinfo.h"
|
||||
#endif
|
||||
|
||||
/* Nonzero if we are defining `strtoul' or `strtouq', operating on
|
||||
unsigned integers. */
|
||||
@ -60,12 +77,17 @@ static const unsigned long long int maxquad = ULONG_LONG_MAX;
|
||||
# define LONG long
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
# define INTERNAL(x) INTERNAL1(x)
|
||||
# define INTERNAL1(x) __##x##_internal
|
||||
#else
|
||||
# define INTERNAL(x) __/**/x/**/_internal
|
||||
#endif
|
||||
|
||||
#ifdef USE_NUMBER_GROUPING
|
||||
/* This file defines a function to check for correct grouping. */
|
||||
# include "grouping.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
|
||||
@ -91,6 +113,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
const char *save, *end;
|
||||
int overflow;
|
||||
|
||||
#ifdef USE_NUMBER_GROUPING
|
||||
/* The thousands character of the current locale. */
|
||||
wchar_t thousands;
|
||||
/* The numeric grouping specification of the current locale,
|
||||
@ -114,7 +137,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
}
|
||||
else
|
||||
grouping = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
if (base < 0 || base == 1 || base > 36)
|
||||
base = 10;
|
||||
@ -162,6 +185,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
/* Save the pointer so we can check later if anything happened. */
|
||||
save = s;
|
||||
|
||||
#ifdef USE_NUMBER_GROUPING
|
||||
if (group)
|
||||
{
|
||||
/* Find the end of the digit string and check its grouping. */
|
||||
@ -176,6 +200,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
|
||||
end = correctly_grouped_prefix (s, end, thousands, grouping);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
end = NULL;
|
||||
|
||||
cutoff = ULONG_MAX / (unsigned LONG int) base;
|
||||
@ -244,7 +269,9 @@ noconv:
|
||||
|
||||
/* External user entry point. */
|
||||
|
||||
#ifdef weak_symbol
|
||||
weak_symbol (strtol)
|
||||
#endif
|
||||
|
||||
INT
|
||||
strtol (nptr, endptr, base)
|
||||
|
Loading…
Reference in New Issue
Block a user