1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

Portability changes from Uli Drepper. [!STDC_HEADERS && !defined(NULL)] Define NULL.

This commit is contained in:
Jim Meyering
1995-07-17 13:34:12 +00:00
parent 787429e3f0
commit e09675ddfb

View File

@@ -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, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#include <limits.h> #include <limits.h>
#ifdef STDC_HEADERS
# include <stddef.h> # include <stddef.h>
# include <stdlib.h> # include <stdlib.h>
#include <errno.h> #else
#include "../locale/localeinfo.h" # 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 /* Nonzero if we are defining `strtoul' or `strtouq', operating on
unsigned integers. */ unsigned integers. */
@@ -60,12 +77,17 @@ static const unsigned long long int maxquad = ULONG_LONG_MAX;
# define LONG long # define LONG long
#endif #endif
#ifdef __STDC__
# define INTERNAL(x) INTERNAL1(x) # define INTERNAL(x) INTERNAL1(x)
# define INTERNAL1(x) __##x##_internal # 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. */ /* This file defines a function to check for correct grouping. */
# include "grouping.h" # include "grouping.h"
#endif
/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. /* 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; const char *save, *end;
int overflow; int overflow;
#ifdef USE_NUMBER_GROUPING
/* The thousands character of the current locale. */ /* The thousands character of the current locale. */
wchar_t thousands; wchar_t thousands;
/* The numeric grouping specification of the current locale, /* The numeric grouping specification of the current locale,
@@ -114,7 +137,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
} }
else else
grouping = NULL; grouping = NULL;
#endif
if (base < 0 || base == 1 || base > 36) if (base < 0 || base == 1 || base > 36)
base = 10; base = 10;
@@ -162,6 +185,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
/* Save the pointer so we can check later if anything happened. */ /* Save the pointer so we can check later if anything happened. */
save = s; save = s;
#ifdef USE_NUMBER_GROUPING
if (group) if (group)
{ {
/* Find the end of the digit string and check its grouping. */ /* 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); end = correctly_grouped_prefix (s, end, thousands, grouping);
} }
else else
#endif
end = NULL; end = NULL;
cutoff = ULONG_MAX / (unsigned LONG int) base; cutoff = ULONG_MAX / (unsigned LONG int) base;
@@ -244,7 +269,9 @@ noconv:
/* External user entry point. */ /* External user entry point. */
#ifdef weak_symbol
weak_symbol (strtol) weak_symbol (strtol)
#endif
INT INT
strtol (nptr, endptr, base) strtol (nptr, endptr, base)