From 614b366763e799b956f4c9b83137c1d4eb361eaa Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Wed, 28 Nov 2001 19:52:25 +0000 Subject: [PATCH] Fixed namespace pollution and/or breakage of K&R and C90 support related to the following functions in the following commits: - atoll() in revs 1.23-1.25 - llabs() and lldiv() in revs 1.22 - strtoq() and strtouq() in revs 1.18 C99 functions must not be declared in C90/POSIX.1-1990 sections, and "long long" must not be exposed to compilers that don't support it. Fixed style bugs (mainly misindentation and disorder) related the following functions in the following commits: - atoll() in revs 1.23-1.25 - getprogname() in rev.1.21 - sranddev() in revs 1.19-1.20 - strtoq() and strtouq() in rev.1.13 - user_from_uid() in rev.1.1 Breakage of K&R and C90 support used to be avoided by conditializing the "long long"s for strtoq() and strtouq() on __STRICT_ANSI__, but the conditionals should have gone away in rev.1.13 when the "long long"s went away (the problem was moved to the places that declare quad_t and u_quad_t). --- include/stdlib.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 9b236c9e17dc..24f32ba43fea 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -68,12 +68,14 @@ typedef struct { long rem; /* remainder */ } ldiv_t; +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #ifdef __LONG_LONG_SUPPORTED typedef struct { long long quot; long long rem; } lldiv_t; #endif +#endif #ifndef NULL #define NULL 0 @@ -94,8 +96,10 @@ int atexit __P((void (*)(void))); double atof __P((const char *)); int atoi __P((const char *)); long atol __P((const char *)); +#ifdef __LONG_LONG_SUPPORTED long long - atoll __P((const char *)); + atoll __P((const char *)); +#endif void *bsearch __P((const void *, const void *, size_t, size_t, int (*)(const void *, const void *))); void *calloc __P((size_t, size_t)); @@ -113,12 +117,8 @@ void *realloc __P((void *, size_t)); void srand __P((unsigned)); double strtod __P((const char *, char **)); long strtol __P((const char *, char **, int)); -long long - strtoll __P((const char *, char **, int)); unsigned long strtoul __P((const char *, char **, int)); -unsigned long long - strtoull __P((const char *, char **, int)); int system __P((const char *)); int mblen __P((const char *, size_t)); @@ -127,12 +127,6 @@ int wctomb __P((char *, wchar_t)); int mbtowc __P((wchar_t *, const char *, size_t)); size_t wcstombs __P((char *, const wchar_t *, size_t)); -#ifdef __LONG_LONG_SUPPORTED -long long - llabs __P((long long)) __pure2; -lldiv_t lldiv __P((long long, long long)) __pure2; -#endif - #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) extern char *_malloc_options; extern void (*_malloc_message)__P((char *p1, char *p2, char *p3, char *p4)); @@ -173,12 +167,17 @@ int daemon __P((int, int)); char *devname __P((int, int)); int getloadavg __P((double [], int)); const char * - getprogname __P((void)); + getprogname __P((void)); char *group_from_gid __P((unsigned long, int)); int heapsort __P((void *, size_t, size_t, int (*)(const void *, const void *))); char *initstate __P((unsigned long, char *, long)); +#ifdef __LONG_LONG_SUPPORTED +long long + llabs __P((long long)) __pure2; +lldiv_t lldiv __P((long long, long long)) __pure2; +#endif int mergesort __P((void *, size_t, size_t, int (*)(const void *, const void *))); int radixsort __P((const unsigned char **, int, const unsigned char *, @@ -191,16 +190,22 @@ void *reallocf __P((void *, size_t)); char *realpath __P((const char *, char resolved_path[])); void setprogname __P((const char *)); char *setstate __P((char *)); -void srandom __P((unsigned long)); void sranddev __P((void)); +void srandom __P((unsigned long)); void srandomdev __P((void)); -char *user_from_uid __P((unsigned long, int)); -#ifndef __STRICT_ANSI__ +#ifdef __LONG_LONG_SUPPORTED +long long + strtoll __P((const char *, char **, int)); +#endif __int64_t strtoq __P((const char *, char **, int)); +#ifdef __LONG_LONG_SUPPORTED +unsigned long long + strtoull __P((const char *, char **, int)); +#endif __uint64_t strtouq __P((const char *, char **, int)); -#endif void unsetenv __P((const char *)); +char *user_from_uid __P((unsigned long, int)); #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ __END_DECLS