diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-03-22 15:49:22 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-03-22 15:49:22 +0000 |
commit | 55b24e4e95a715b451507f2790d292fa8b1c2c1c (patch) | |
tree | ae6464b93a9b660617b9f7a569276945294dcce7 /libc | |
parent | 86ea254301f7e2fcd860c4072c0a938b4e048d42 (diff) |
Mark some functions as GNU, provide missing hidden memmem, remove _ISOC99/XOPEN_SOURCE
Diffstat (limited to 'libc')
30 files changed, 69 insertions, 22 deletions
diff --git a/libc/inet/if_index.c b/libc/inet/if_index.c index fdb30f00a..ed46db231 100644 --- a/libc/inet/if_index.c +++ b/libc/inet/if_index.c @@ -35,11 +35,13 @@ #include "netlinkaccess.h" -libc_hidden_proto(strndup) libc_hidden_proto(strncpy) libc_hidden_proto(strdup) libc_hidden_proto(ioctl) libc_hidden_proto(close) +#if __ASSUME_NETLINK_SUPPORT +libc_hidden_proto(strndup) +#endif extern int __opensock(void) attribute_hidden; diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index ee47cf4f5..90e30563b 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -94,7 +94,6 @@ libc_hidden_proto(strcmp) libc_hidden_proto(strcpy) libc_hidden_proto(strlen) libc_hidden_proto(strncmp) -libc_hidden_proto(strnlen) libc_hidden_proto(memmove) libc_hidden_proto(getpid) libc_hidden_proto(socket) diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index 1ab84fc56..bd3b3a91d 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -27,7 +27,6 @@ * and is useful in debugging the stdio code. */ -#define _ISOC99_SOURCE #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 18da40a33..6521b44e4 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -22,7 +22,6 @@ # include <config.h> #endif -#define _XOPEN_SOURCE 500 #include <features.h> #ifdef __UCLIBC__ #undef _LIBC diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 95b0917df..ca69c1cea 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -60,7 +60,6 @@ libc_hidden_proto(memcpy) libc_hidden_proto(memset) -libc_hidden_proto(stpcpy) libc_hidden_proto(strtok_r) libc_hidden_proto(strlen) libc_hidden_proto(strcmp) @@ -192,6 +191,7 @@ static const char utf8[] = "UTF-8"; */ static char hr_locale[(MAX_LOCALE_CATEGORY_STR * LC_ALL) + MAX_LOCALE_STR]; +libc_hidden_proto(stpcpy) libc_hidden_proto(newlocale) static void update_hr_locale(const unsigned char *spec) @@ -1082,6 +1082,7 @@ libc_hidden_def(__XL_NPP(nl_langinfo)) /**********************************************************************/ #ifdef L_newlocale +libc_hidden_proto(stpcpy) libc_hidden_proto(newlocale) #ifdef __UCLIBC_MJN3_ONLY__ diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 94e0314b5..471ea55f0 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -532,7 +532,7 @@ regerror (errcode, preg, errbuf, errbuf_size) { if (BE (msg_size > errbuf_size, 0)) { -#if defined HAVE_MEMPCPY || defined _LIBC +#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else memcpy (errbuf, msg, errbuf_size - 1); diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 77c09a011..9328f6025 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -28,7 +28,9 @@ #ifdef __UCLIBC__ #undef _LIBC #define _REGEX_RE_COMP -#define HAVE_MEMPCPY +#ifdef __USE_GNU +# define HAVE_MEMPCPY +#endif #define HAVE_LANGINFO #define HAVE_LANGINFO_CODESET #include <stdbool.h> @@ -83,8 +85,10 @@ libc_hidden_proto(strlen) libc_hidden_proto(strncpy) libc_hidden_proto(getenv) libc_hidden_proto(strcasecmp) -libc_hidden_proto(mempcpy) libc_hidden_proto(abort) +#ifdef __USE_GNU +libc_hidden_proto(mempcpy) +#endif #endif diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index 29640734d..cf5843ec5 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -26,7 +26,9 @@ #ifdef __UCLIBC__ # undef _LIBC # define _REGEX_RE_COMP -# define HAVE_MEMPCPY +# ifdef __USE_GNU +# define HAVE_MEMPCPY +# endif # define STDC_HEADERS # define RE_TRANSLATE_TYPE char * #endif @@ -41,8 +43,10 @@ libc_hidden_proto(memcpy) libc_hidden_proto(strcmp) libc_hidden_proto(strlen) libc_hidden_proto(printf) -libc_hidden_proto(mempcpy) libc_hidden_proto(abort) +#ifdef __USE_GNU +libc_hidden_proto(mempcpy) +#endif /* AIX requires this to be the first thing in the file. */ #if defined _AIX && !defined REGEX_MALLOC @@ -8281,7 +8285,7 @@ regerror (errcode, preg, errbuf, errbuf_size) { if (msg_size > errbuf_size) { -#if defined HAVE_MEMPCPY || defined _LIBC +#if (defined HAVE_MEMPCPY || defined _LIBC) && defined __USE_GNU *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else memcpy (errbuf, msg, errbuf_size - 1); diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c index bafc34ce0..2c8917e19 100644 --- a/libc/misc/regex/regexec.c +++ b/libc/misc/regex/regexec.c @@ -385,7 +385,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, if (BE (s == NULL, 0)) return -2; -#if defined _LIBC || defined __UCLIBC__ +#if (defined _LIBC || defined __UCLIBC__) && defined __USE_GNU memcpy (__mempcpy (s, string1, length1), string2, length2); #else memcpy (s, string1, length1); diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index f95ad2351..e6d96756e 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -164,7 +164,6 @@ libc_hidden_proto(strcmp) libc_hidden_proto(strcpy) libc_hidden_proto(strlen) libc_hidden_proto(strncpy) -libc_hidden_proto(strnlen) /* libc_hidden_proto(sprintf) */ libc_hidden_proto(open) libc_hidden_proto(read) @@ -606,6 +605,8 @@ libc_hidden_def(localtime_r) #ifdef __UCLIBC_HAS_TM_EXTENSIONS__ +libc_hidden_proto(strnlen) + struct ll_tzname_item; typedef struct ll_tzname_item { diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 91a78fb22..64bab37e0 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -98,7 +98,6 @@ * Manuel */ -#define _ISOC99_SOURCE #include <errno.h> #include <stddef.h> #include <limits.h> diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index b41f6a118..dfb0d19db 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,7 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define _ISOC99_SOURCE #include <stdio.h> #include <errno.h> #include <paths.h> diff --git a/libc/string/basename.c b/libc/string/basename.c index 2c4937fca..739eaec56 100644 --- a/libc/string/basename.c +++ b/libc/string/basename.c @@ -7,6 +7,7 @@ #include "_string.h" +#ifdef __USE_GNU libc_hidden_proto(basename) char *basename(const char *path) @@ -25,3 +26,4 @@ char *basename(const char *path) return (char *) p; } libc_hidden_def(basename) +#endif diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index c2e8547be..5d4e6f151 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -19,6 +19,7 @@ #include <string.h> #include <stddef.h> +#ifdef __USE_GNU libc_hidden_proto(memmem) libc_hidden_proto(memcmp) @@ -50,3 +51,4 @@ void *memmem (const void *haystack, size_t haystack_len, return NULL; } libc_hidden_def(memmem) +#endif diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index 7c251914d..46d19024b 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -7,6 +7,7 @@ #include <string.h> +#ifdef __USE_GNU libc_hidden_proto(mempcpy) libc_hidden_proto(memcpy) @@ -16,3 +17,4 @@ void *mempcpy (void *dstpp, const void *srcpp, size_t len) return (void *)(((char *)dstpp) + len); } libc_hidden_def(mempcpy) +#endif diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c index f63efa46b..43439d5ce 100644 --- a/libc/string/generic/memrchr.c +++ b/libc/string/generic/memrchr.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <limits.h> +#ifdef __USE_GNU libc_hidden_proto(memrchr) libc_hidden_proto(abort) @@ -174,3 +175,4 @@ void *memrchr (const void * s, int c_in, size_t n) return 0; } libc_hidden_def(memrchr) +#endif diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c index 85fc09836..6bf245265 100644 --- a/libc/string/generic/rawmemchr.c +++ b/libc/string/generic/rawmemchr.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <limits.h> +#ifdef __USE_GNU libc_hidden_proto(rawmemchr) libc_hidden_proto(abort) @@ -160,3 +161,4 @@ void *rawmemchr (const void * s, int c_in) } } libc_hidden_def(rawmemchr) +#endif diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c index e699a6dfa..6b2d85e9b 100644 --- a/libc/string/generic/strchrnul.c +++ b/libc/string/generic/strchrnul.c @@ -24,6 +24,7 @@ #include <string.h> #include <stdlib.h> +#ifdef __USE_GNU libc_hidden_proto(strchrnul) libc_hidden_proto(abort) @@ -165,3 +166,4 @@ char *strchrnul (const char *s, int c_in) return NULL; } libc_hidden_def(strchrnul) +#endif diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c index 31b5ba8e0..3156e469a 100644 --- a/libc/string/generic/strnlen.c +++ b/libc/string/generic/strnlen.c @@ -24,6 +24,7 @@ #include <string.h> #include <stdlib.h> +#ifdef __USE_GNU libc_hidden_proto(strnlen) libc_hidden_proto(abort) @@ -160,3 +161,4 @@ size_t strnlen (const char *str, size_t maxlen) return char_ptr - str; } libc_hidden_def(strnlen) +#endif diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 0ab18b35e..bae394a80 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -22,7 +22,13 @@ libc_hidden_proto(strtok_r) libc_hidden_proto(strspn) libc_hidden_proto(strpbrk) +#ifdef __USE_GNU +# define __rawmemchr rawmemchr libc_hidden_proto(rawmemchr) +#else +# define __rawmemchr strchr +libc_hidden_proto(strchr) +#endif /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as @@ -54,7 +60,7 @@ char *strtok_r (char *s, const char *delim, char **save_ptr) s = strpbrk (token, delim); if (s == NULL) /* This token finishes the string. */ - *save_ptr = rawmemchr (token, '\0'); + *save_ptr = __rawmemchr (token, '\0'); else { /* Terminate the token and make *SAVE_PTR point past it. */ diff --git a/libc/string/i386/strnlen.c b/libc/string/i386/strnlen.c index af512f10a..77b5c7568 100644 --- a/libc/string/i386/strnlen.c +++ b/libc/string/i386/strnlen.c @@ -32,6 +32,7 @@ #include <string.h> +#ifdef __USE_GNU libc_hidden_proto(strnlen) size_t strnlen(const char *s, size_t count) { @@ -52,3 +53,4 @@ size_t strnlen(const char *s, size_t count) return __res; } libc_hidden_def(strnlen) +#endif diff --git a/libc/string/memmem.c b/libc/string/memmem.c index f57733c4a..fd60f1e7b 100644 --- a/libc/string/memmem.c +++ b/libc/string/memmem.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU +libc_hidden_proto(memmem) void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) { @@ -36,3 +38,5 @@ void *memmem(const void *haystack, size_t haystacklen, return NULL; } +libc_hidden_def(memmem) +#endif diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c index 70626f24a..cf4af8d39 100644 --- a/libc/string/mempcpy.c +++ b/libc/string/mempcpy.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wmempcpy wmempcpy #else @@ -35,3 +37,4 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n) } libc_hidden_def(Wmempcpy) +#endif diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c index 0bb67b2e5..2959396b2 100644 --- a/libc/string/memrchr.c +++ b/libc/string/memrchr.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + libc_hidden_proto(memrchr) void *memrchr(const void *s, int c, size_t n) @@ -33,3 +35,4 @@ void *memrchr(const void *s, int c, size_t n) #undef np libc_hidden_def(memrchr) +#endif diff --git a/libc/string/rawmemchr.c b/libc/string/rawmemchr.c index 754a34e18..1bbcb01b5 100644 --- a/libc/string/rawmemchr.c +++ b/libc/string/rawmemchr.c @@ -7,8 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU libc_hidden_proto(rawmemchr) - void *rawmemchr(const void *s, int c) { register const unsigned char *r = s; @@ -18,3 +18,4 @@ void *rawmemchr(const void *s, int c) return (void *) r; /* silence the warning */ } libc_hidden_def(rawmemchr) +#endif diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c index cc3883402..6fe7f6c3d 100644 --- a/libc/string/strchrnul.c +++ b/libc/string/strchrnul.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wstrchrnul wcschrnul #else @@ -22,3 +24,4 @@ Wchar *Wstrchrnul(register const Wchar *s, Wint c) return (Wchar *) s; } libc_hidden_def(Wstrchrnul) +#endif diff --git a/libc/string/strnlen.c b/libc/string/strnlen.c index 547dd23b2..8fbc25c11 100644 --- a/libc/string/strnlen.c +++ b/libc/string/strnlen.c @@ -7,6 +7,8 @@ #include "_string.h" +#ifdef __USE_GNU + #ifdef WANT_WIDE # define Wstrnlen wcsnlen #else @@ -35,3 +37,4 @@ size_t Wstrnlen(const Wchar *s, size_t max) #undef maxp libc_hidden_def(Wstrnlen) +#endif diff --git a/libc/sysdeps/linux/common/setegid.c b/libc/sysdeps/linux/common/setegid.c index e0bbfd4bc..33c627c51 100644 --- a/libc/sysdeps/linux/common/setegid.c +++ b/libc/sysdeps/linux/common/setegid.c @@ -11,7 +11,7 @@ #include <sys/types.h> #include <sys/syscall.h> -#if defined __NR_setresgid || defined __NR_setresgid32 +#if (defined __NR_setresgid || defined __NR_setresgid32) && defined __USE_GNU libc_hidden_proto(setresgid) #endif libc_hidden_proto(setregid) @@ -26,7 +26,7 @@ int setegid(gid_t gid) return -1; } -#if defined __NR_setresgid || defined __NR_setresgid32 +#if (defined __NR_setresgid || defined __NR_setresgid32) && defined __USE_GNU result = setresgid(-1, gid, -1); if (result == -1 && errno == ENOSYS) /* Will also set the saved group ID if egid != gid, diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c index e5ed576ff..35a68334d 100644 --- a/libc/sysdeps/linux/common/seteuid.c +++ b/libc/sysdeps/linux/common/seteuid.c @@ -13,7 +13,7 @@ libc_hidden_proto(seteuid) -#if defined __NR_setresuid || defined __NR_setresuid32 +#if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU libc_hidden_proto(setresuid) #endif libc_hidden_proto(setreuid) @@ -28,7 +28,7 @@ int seteuid(uid_t uid) return -1; } -#if defined __NR_setresuid || defined __NR_setresuid32 +#if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU result = setresuid(-1, uid, -1); if (result == -1 && errno == ENOSYS) /* Will also set the saved user ID if euid != uid, diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index eaf6a40aa..0c90f376d 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -45,7 +45,6 @@ libc_hidden_proto(execvp) libc_hidden_proto(memcpy) libc_hidden_proto(strchr) libc_hidden_proto(strlen) -libc_hidden_proto(strchrnul) libc_hidden_proto(execve) libc_hidden_proto(mmap) libc_hidden_proto(munmap) @@ -220,6 +219,8 @@ int execlp(const char *file, const char *arg, ...) /**********************************************************************/ #ifdef L_execvp +libc_hidden_proto(strchrnul) + /* Use a default path that matches glibc behavior, since SUSv3 says * this is implementation-defined. The default is current working dir, * /bin, and then /usr/bin. */ |