From 55b24e4e95a715b451507f2790d292fa8b1c2c1c Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 22 Mar 2006 15:49:22 +0000 Subject: Mark some functions as GNU, provide missing hidden memmem, remove _ISOC99/XOPEN_SOURCE --- libc/string/basename.c | 2 ++ libc/string/generic/memmem.c | 2 ++ libc/string/generic/mempcpy.c | 2 ++ libc/string/generic/memrchr.c | 2 ++ libc/string/generic/rawmemchr.c | 2 ++ libc/string/generic/strchrnul.c | 2 ++ libc/string/generic/strnlen.c | 2 ++ libc/string/generic/strtok_r.c | 8 +++++++- libc/string/i386/strnlen.c | 2 ++ libc/string/memmem.c | 4 ++++ libc/string/mempcpy.c | 3 +++ libc/string/memrchr.c | 3 +++ libc/string/rawmemchr.c | 3 ++- libc/string/strchrnul.c | 3 +++ libc/string/strnlen.c | 3 +++ 15 files changed, 41 insertions(+), 2 deletions(-) (limited to 'libc/string') 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 #include +#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 +#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 #include +#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 #include +#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 #include +#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 #include +#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 +#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 -- cgit v1.2.3