diff options
Diffstat (limited to 'libc/string/generic')
25 files changed, 122 insertions, 95 deletions
diff --git a/libc/string/generic/memchr.c b/libc/string/generic/memchr.c index 68c820814..9942b609b 100644 --- a/libc/string/generic/memchr.c +++ b/libc/string/generic/memchr.c @@ -25,12 +25,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Search no more than N bytes of S for C. */ -void attribute_hidden *__memchr (const void * s, int c_in, size_t n) +void *memchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -171,5 +173,5 @@ void attribute_hidden *__memchr (const void * s, int c_in, size_t n) return 0; } - -strong_alias(__memchr,memchr) +libc_hidden_proto(memchr) +libc_hidden_def(memchr) diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c index 13e11692a..13de370bb 100644 --- a/libc/string/generic/memcmp.c +++ b/libc/string/generic/memcmp.c @@ -273,7 +273,7 @@ memcmp_not_common_alignment (srcp1, srcp2, len) } int -attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) +memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) { op_t a0; op_t b0; @@ -329,7 +329,6 @@ attribute_hidden __memcmp (const __ptr_t s1, const __ptr_t s2, size_t len) return 0; } - -strong_alias(__memcmp,memcmp) - -strong_alias(__memcmp,bcmp) +libc_hidden_proto(memcmp) +libc_hidden_def(memcmp) +strong_alias(memcmp,bcmp) diff --git a/libc/string/generic/memcpy.c b/libc/string/generic/memcpy.c index 6db4d0d44..692a254f7 100644 --- a/libc/string/generic/memcpy.c +++ b/libc/string/generic/memcpy.c @@ -209,7 +209,7 @@ static void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2); } -void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len) +void *memcpy (void *dstpp, const void *srcpp, size_t len) { unsigned long int dstp = (long int) dstpp; unsigned long int srcp = (long int) srcpp; @@ -242,5 +242,5 @@ void attribute_hidden *__memcpy (void *dstpp, const void *srcpp, size_t len) return dstpp; } - -strong_alias(__memcpy,memcpy) +libc_hidden_proto(memcpy) +libc_hidden_def(memcpy) diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index 0353759e3..e8982c078 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -19,8 +19,10 @@ #include <string.h> #include <stddef.h> +libc_hidden_proto(memcmp) + /* Return the first occurrence of NEEDLE in HAYSTACK. */ -void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, +void *memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) { const char *begin; @@ -39,12 +41,12 @@ void attribute_hidden *__memmem (const void *haystack, size_t haystack_len, for (begin = (const char *) haystack; begin <= last_possible; ++begin) if (begin[0] == ((const char *) needle)[0] && - !__memcmp ((const void *) &begin[1], + !memcmp ((const void *) &begin[1], (const void *) ((const char *) needle + 1), needle_len - 1)) return (void *) begin; return NULL; } - -strong_alias(__memmem,memmem) +libc_hidden_proto(memmem) +libc_hidden_def(memmem) diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index e34b0005d..0157b148c 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -24,6 +24,8 @@ #include "memcopy.h" #include "pagecopy.h" +libc_hidden_proto(memcpy) + static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len) { op_t a0, a1; @@ -206,7 +208,7 @@ static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2); } -void attribute_hidden *__memmove (void *dest, const void *src, size_t len) +void *memmove (void *dest, const void *src, size_t len) { unsigned long int dstp = (long int) dest; unsigned long int srcp = (long int) src; @@ -217,7 +219,7 @@ void attribute_hidden *__memmove (void *dest, const void *src, size_t len) { #if 1 #warning REMINDER: generic-opt memmove assumes memcpy does forward copying! - __memcpy(dest, src, len); + memcpy(dest, src, len); #else /* Copy from the beginning to the end. */ @@ -276,5 +278,5 @@ void attribute_hidden *__memmove (void *dest, const void *src, size_t len) return (dest); } - -strong_alias(__memmove,memmove) +libc_hidden_proto(memmove) +libc_hidden_def(memmove) diff --git a/libc/string/generic/mempcpy.c b/libc/string/generic/mempcpy.c index d121967cd..ea4dec2b1 100644 --- a/libc/string/generic/mempcpy.c +++ b/libc/string/generic/mempcpy.c @@ -7,10 +7,12 @@ #include <string.h> -void attribute_hidden *__mempcpy (void *dstpp, const void *srcpp, size_t len) +libc_hidden_proto(memcpy) + +void *mempcpy (void *dstpp, const void *srcpp, size_t len) { - __memcpy(dstpp, srcpp, len); + memcpy(dstpp, srcpp, len); return (void *)(((char *)dstpp) + len); } - -strong_alias(__mempcpy,mempcpy) +libc_hidden_proto(mempcpy) +libc_hidden_def(mempcpy) diff --git a/libc/string/generic/memrchr.c b/libc/string/generic/memrchr.c index d27ae03ef..ab61eac72 100644 --- a/libc/string/generic/memrchr.c +++ b/libc/string/generic/memrchr.c @@ -26,12 +26,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Search no more than N bytes of S for C. */ -void attribute_hidden *__memrchr (const void * s, int c_in, size_t n) +void *memrchr (const void * s, int c_in, size_t n) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -170,5 +172,5 @@ void attribute_hidden *__memrchr (const void * s, int c_in, size_t n) return 0; } - -strong_alias(__memrchr,memrchr) +libc_hidden_proto(memrchr) +libc_hidden_def(memrchr) diff --git a/libc/string/generic/memset.c b/libc/string/generic/memset.c index 91401d7ee..18c065cac 100644 --- a/libc/string/generic/memset.c +++ b/libc/string/generic/memset.c @@ -19,7 +19,7 @@ #include <string.h> #include "memcopy.h" -void attribute_hidden *__memset (void *dstpp, int c, size_t len) +void *memset (void *dstpp, int c, size_t len) { long int dstp = (long int) dstpp; @@ -82,5 +82,5 @@ void attribute_hidden *__memset (void *dstpp, int c, size_t len) return dstpp; } - -strong_alias(__memset,memset) +libc_hidden_proto(memset) +libc_hidden_def(memset) diff --git a/libc/string/generic/rawmemchr.c b/libc/string/generic/rawmemchr.c index d1be620eb..3fc0e52f3 100644 --- a/libc/string/generic/rawmemchr.c +++ b/libc/string/generic/rawmemchr.c @@ -25,12 +25,14 @@ #include <stdlib.h> #include <limits.h> +libc_hidden_proto(abort) + #include "memcopy.h" #define LONG_MAX_32_BITS 2147483647 /* Find the first occurrence of C in S. */ -void attribute_hidden *__rawmemchr (const void * s, int c_in) +void *rawmemchr (const void * s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -156,5 +158,5 @@ void attribute_hidden *__rawmemchr (const void * s, int c_in) } } } - -strong_alias(__rawmemchr,rawmemchr) +libc_hidden_proto(rawmemchr) +libc_hidden_def(rawmemchr) diff --git a/libc/string/generic/strcat.c b/libc/string/generic/strcat.c index 96412acc5..5111a9a0f 100644 --- a/libc/string/generic/strcat.c +++ b/libc/string/generic/strcat.c @@ -20,7 +20,7 @@ #include "memcopy.h" /* Append SRC on the end of DEST. */ -char attribute_hidden *__strcat (char *dest, const char *src) +char *strcat (char *dest, const char *src) { char *s1 = dest; const char *s2 = src; @@ -44,5 +44,5 @@ char attribute_hidden *__strcat (char *dest, const char *src) return dest; } - -strong_alias(__strcat,strcat) +libc_hidden_proto(strcat) +libc_hidden_def(strcat) diff --git a/libc/string/generic/strchr.c b/libc/string/generic/strchr.c index dcb30ad7b..5675ce4ba 100644 --- a/libc/string/generic/strchr.c +++ b/libc/string/generic/strchr.c @@ -24,10 +24,12 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + #include "memcopy.h" /* Find the first occurrence of C in S. */ -char attribute_hidden *__strchr (const char *s, int c_in) +char *strchr (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -178,7 +180,6 @@ char attribute_hidden *__strchr (const char *s, int c_in) return NULL; } - -strong_alias(__strchr,strchr) - -strong_alias(__strchr,index) +libc_hidden_proto(strchr) +libc_hidden_def(strchr) +strong_alias(strchr,index) diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c index a2aafbfb0..eccdba247 100644 --- a/libc/string/generic/strchrnul.c +++ b/libc/string/generic/strchrnul.c @@ -24,10 +24,12 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + #include "memcopy.h" /* Find the first occurrence of C in S or the final NUL byte. */ -char attribute_hidden *__strchrnul (const char *s, int c_in) +char *strchrnul (const char *s, int c_in) { const unsigned char *char_ptr; const unsigned long int *longword_ptr; @@ -161,5 +163,5 @@ char attribute_hidden *__strchrnul (const char *s, int c_in) /* This should never happen. */ return NULL; } - -strong_alias(__strchrnul,strchrnul) +libc_hidden_proto(strchrnul) +libc_hidden_def(strchrnul) diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c index 209aeed15..1049934a8 100644 --- a/libc/string/generic/strcmp.c +++ b/libc/string/generic/strcmp.c @@ -23,7 +23,7 @@ /* Compare S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int attribute_hidden __strcmp (const char *p1, const char *p2) +int strcmp (const char *p1, const char *p2) { register const unsigned char *s1 = (const unsigned char *) p1; register const unsigned char *s2 = (const unsigned char *) p2; @@ -40,10 +40,11 @@ int attribute_hidden __strcmp (const char *p1, const char *p2) return c1 - c2; } - -strong_alias(__strcmp,strcmp) +libc_hidden_proto(strcmp) +libc_hidden_def(strcmp) #ifndef __UCLIBC_HAS_LOCALE__ -hidden_strong_alias(__strcmp,__strcoll) -strong_alias(__strcmp,strcoll) +strong_alias(strcmp,strcoll) +libc_hidden_proto(strcoll) +libc_hidden_def(strcoll) #endif diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c index 9280d3561..ab2928e55 100644 --- a/libc/string/generic/strcpy.c +++ b/libc/string/generic/strcpy.c @@ -23,7 +23,7 @@ #include "bp-checks.h" /* Copy SRC to DEST. */ -char attribute_hidden *__strcpy (char *dest, const char *src) +char *strcpy (char *dest, const char *src) { reg_char c; char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src); @@ -43,5 +43,5 @@ char attribute_hidden *__strcpy (char *dest, const char *src) return dest; } - -strong_alias(__strcpy,strcpy) +libc_hidden_proto(strcpy) +libc_hidden_def(strcpy) diff --git a/libc/string/generic/strcspn.c b/libc/string/generic/strcspn.c index a06577bca..7fa49a0dc 100644 --- a/libc/string/generic/strcspn.c +++ b/libc/string/generic/strcspn.c @@ -18,19 +18,21 @@ #include <string.h> +libc_hidden_proto(strchr) + /* Return the length of the maximum initial segment of S which contains no characters from REJECT. */ -size_t attribute_hidden __strcspn (const char *s, const char *reject) +size_t strcspn (const char *s, const char *reject) { size_t count = 0; while (*s != '\0') - if (__strchr (reject, *s++) == NULL) + if (strchr (reject, *s++) == NULL) ++count; else return count; return count; } - -strong_alias(__strcspn,strcspn) +libc_hidden_proto(strcspn) +libc_hidden_def(strcspn) diff --git a/libc/string/generic/strlen.c b/libc/string/generic/strlen.c index 6c1b5eae3..08b5fa830 100644 --- a/libc/string/generic/strlen.c +++ b/libc/string/generic/strlen.c @@ -22,9 +22,11 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + /* Return the length of the null-terminated string STR. Scan for the null terminator quickly by testing four bytes at a time. */ -size_t attribute_hidden __strlen (const char *str) +size_t strlen (const char *str) { const char *char_ptr; const unsigned long int *longword_ptr; @@ -146,5 +148,5 @@ size_t attribute_hidden __strlen (const char *str) } } } - -strong_alias(__strlen,strlen) +libc_hidden_proto(strlen) +libc_hidden_def(strlen) diff --git a/libc/string/generic/strncat.c b/libc/string/generic/strncat.c index 5ece4d248..0cdb21a7a 100644 --- a/libc/string/generic/strncat.c +++ b/libc/string/generic/strncat.c @@ -20,7 +20,7 @@ #include "memcopy.h" -char attribute_hidden *__strncat (char *s1, const char *s2, size_t n) +char *strncat (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -73,5 +73,5 @@ char attribute_hidden *__strncat (char *s1, const char *s2, size_t n) return s; } - -strong_alias(__strncat,strncat) +libc_hidden_proto(strncat) +libc_hidden_def(strncat) diff --git a/libc/string/generic/strncmp.c b/libc/string/generic/strncmp.c index 849726f6b..a6285e3a4 100644 --- a/libc/string/generic/strncmp.c +++ b/libc/string/generic/strncmp.c @@ -23,7 +23,7 @@ returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ -int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n) +int strncmp (const char *s1, const char *s2, size_t n) { unsigned reg_char c1 = '\0'; unsigned reg_char c2 = '\0'; @@ -64,5 +64,5 @@ int attribute_hidden __strncmp (const char *s1, const char *s2, size_t n) return c1 - c2; } - -strong_alias(__strncmp,strncmp) +libc_hidden_proto(strncmp) +libc_hidden_def(strncmp) diff --git a/libc/string/generic/strncpy.c b/libc/string/generic/strncpy.c index ca4f59e52..3c9ccb9ce 100644 --- a/libc/string/generic/strncpy.c +++ b/libc/string/generic/strncpy.c @@ -19,7 +19,7 @@ #include <string.h> #include "memcopy.h" -char attribute_hidden *__strncpy (char *s1, const char *s2, size_t n) +char *strncpy (char *s1, const char *s2, size_t n) { reg_char c; char *s = s1; @@ -78,5 +78,5 @@ char attribute_hidden *__strncpy (char *s1, const char *s2, size_t n) return s; } - -strong_alias(__strncpy,strncpy) +libc_hidden_proto(strncpy) +libc_hidden_def(strncpy) diff --git a/libc/string/generic/strnlen.c b/libc/string/generic/strnlen.c index 4b96dde31..95e8a77be 100644 --- a/libc/string/generic/strnlen.c +++ b/libc/string/generic/strnlen.c @@ -24,9 +24,11 @@ #include <string.h> #include <stdlib.h> +libc_hidden_proto(abort) + /* Find the length of S, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ -size_t attribute_hidden __strnlen (const char *str, size_t maxlen) +size_t strnlen (const char *str, size_t maxlen) { const char *char_ptr, *end_ptr = str + maxlen; const unsigned long int *longword_ptr; @@ -156,5 +158,5 @@ size_t attribute_hidden __strnlen (const char *str, size_t maxlen) char_ptr = end_ptr; return char_ptr - str; } - -strong_alias(__strnlen,strnlen) +libc_hidden_proto(strnlen) +libc_hidden_def(strnlen) diff --git a/libc/string/generic/strrchr.c b/libc/string/generic/strrchr.c index 529016ede..cf4c6dd3b 100644 --- a/libc/string/generic/strrchr.c +++ b/libc/string/generic/strrchr.c @@ -18,8 +18,10 @@ #include <string.h> +libc_hidden_proto(strchr) + /* Find the last occurrence of C in S. */ -char attribute_hidden *__strrchr (const char *s, int c) +char *strrchr (const char *s, int c) { register const char *found, *p; @@ -28,10 +30,10 @@ char attribute_hidden *__strrchr (const char *s, int c) /* Since strchr is fast, we use it rather than the obvious loop. */ if (c == '\0') - return __strchr (s, '\0'); + return strchr (s, '\0'); found = NULL; - while ((p = __strchr (s, c)) != NULL) + while ((p = strchr (s, c)) != NULL) { found = p; s = p + 1; @@ -39,7 +41,6 @@ char attribute_hidden *__strrchr (const char *s, int c) return (char *) found; } - -strong_alias(__strrchr,strrchr) - -strong_alias (__strrchr,rindex) +libc_hidden_proto(strrchr) +libc_hidden_def(strrchr) +strong_alias(strrchr,rindex) diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index 762b07ff9..5d9c8c307 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -16,11 +16,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strpbrk __strpbrk - #include <string.h> -char attribute_hidden *__strsep (char **stringp, const char *delim) +libc_hidden_proto(strchr) +libc_hidden_proto(strpbrk) + +char *strsep (char **stringp, const char *delim) { char *begin, *end; @@ -44,7 +45,7 @@ char attribute_hidden *__strsep (char **stringp, const char *delim) else if (*begin == '\0') end = NULL; else - end = __strchr (begin + 1, ch); + end = strchr (begin + 1, ch); } } else @@ -63,5 +64,5 @@ char attribute_hidden *__strsep (char **stringp, const char *delim) return begin; } - -strong_alias(__strsep,strsep) +libc_hidden_proto(strsep) +libc_hidden_def(strsep) diff --git a/libc/string/generic/strspn.c b/libc/string/generic/strspn.c index 129c58742..cd2882456 100644 --- a/libc/string/generic/strspn.c +++ b/libc/string/generic/strspn.c @@ -20,7 +20,7 @@ /* Return the length of the maximum initial segment of S which contains only characters in ACCEPT. */ -size_t attribute_hidden __strspn (const char *s, const char *accept) +size_t strspn (const char *s, const char *accept) { const char *p; const char *a; @@ -39,5 +39,5 @@ size_t attribute_hidden __strspn (const char *s, const char *accept) return count; } - -strong_alias(__strspn,strspn) +libc_hidden_proto(strspn) +libc_hidden_def(strspn) diff --git a/libc/string/generic/strstr.c b/libc/string/generic/strstr.c index 12e384014..a7442d614 100644 --- a/libc/string/generic/strstr.c +++ b/libc/string/generic/strstr.c @@ -30,7 +30,7 @@ typedef unsigned chartype; -char attribute_hidden *__strstr (const char *phaystack, const char *pneedle) +char *strstr (const char *phaystack, const char *pneedle) { const unsigned char *haystack, *needle; chartype b; @@ -109,5 +109,5 @@ foundneedle: ret0: return 0; } - -strong_alias(__strstr,strstr) +libc_hidden_proto(strstr) +libc_hidden_def(strstr) diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 1a11166dd..3f7ed2c9f 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -20,6 +20,10 @@ #define _GNU_SOURCE #include <string.h> +libc_hidden_proto(strspn) +libc_hidden_proto(strpbrk) +libc_hidden_proto(rawmemchr) + /* Parse S into tokens separated by characters in DELIM. If S is NULL, the saved pointer in SAVE_PTR is used as the next starting point. For example: @@ -30,7 +34,7 @@ x = strtok_r(NULL, "=", &sp); // x = NULL // s = "abc\0-def\0" */ -char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) +char *strtok_r (char *s, const char *delim, char **save_ptr) { char *token; @@ -38,7 +42,7 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) s = *save_ptr; /* Scan leading delimiters. */ - s += __strspn (s, delim); + s += strspn (s, delim); if (*s == '\0') { *save_ptr = s; @@ -47,10 +51,10 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) /* Find the end of the token. */ token = s; - s = __strpbrk (token, delim); + 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. */ @@ -59,5 +63,5 @@ char attribute_hidden *__strtok_r (char *s, const char *delim, char **save_ptr) } return token; } - -strong_alias(__strtok_r,strtok_r) +libc_hidden_proto(strtok_r) +libc_hidden_def(strtok_r) |