summaryrefslogtreecommitdiffstats
path: root/libc/string/generic
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/generic')
-rw-r--r--libc/string/generic/memcmp.c2
-rw-r--r--libc/string/generic/memmem.c2
-rw-r--r--libc/string/generic/memmove.c8
-rw-r--r--libc/string/generic/mempcpy.c2
-rw-r--r--libc/string/generic/memrchr.c2
-rw-r--r--libc/string/generic/rawmemchr.c2
-rw-r--r--libc/string/generic/strchr.c6
-rw-r--r--libc/string/generic/strchrnul.c6
-rw-r--r--libc/string/generic/strncmp.c2
-rw-r--r--libc/string/generic/strnlen.c2
-rw-r--r--libc/string/generic/strrchr.c2
-rw-r--r--libc/string/generic/strsep.c5
-rw-r--r--libc/string/generic/strtok_r.c8
13 files changed, 40 insertions, 9 deletions
diff --git a/libc/string/generic/memcmp.c b/libc/string/generic/memcmp.c
index 41f15369d..b754a5195 100644
--- a/libc/string/generic/memcmp.c
+++ b/libc/string/generic/memcmp.c
@@ -331,4 +331,6 @@ memcmp (const __ptr_t s1, const __ptr_t s2, size_t len)
return 0;
}
libc_hidden_def(memcmp)
+#ifdef __UCLIBC_SUSV3_LEGACY__
strong_alias(memcmp,bcmp)
+#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/memmove.c b/libc/string/generic/memmove.c
index 68caacd78..0e51ea771 100644
--- a/libc/string/generic/memmove.c
+++ b/libc/string/generic/memmove.c
@@ -29,7 +29,8 @@ libc_hidden_proto(memcpy)
static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len)
{
- op_t a0, a1;
+ op_t a0 = 0;
+ op_t a1 = 0;
switch (len % 8)
{
@@ -133,7 +134,10 @@ static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len)
static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len)
{
- op_t a0, a1, a2, a3;
+ op_t a0 = 0;
+ op_t a1 = 0;
+ op_t a2 = 0;
+ op_t a3 = 0;
int sh_1, sh_2;
/* Calculate how to shift a word read at the memory operation
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/strchr.c b/libc/string/generic/strchr.c
index b1ffc7538..8d401ec8c 100644
--- a/libc/string/generic/strchr.c
+++ b/libc/string/generic/strchr.c
@@ -41,8 +41,8 @@ char *strchr (const char *s, int c_in)
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = s; ((unsigned long int) char_ptr
- & (sizeof (longword) - 1)) != 0;
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
++char_ptr)
if (*char_ptr == c)
return (void *) char_ptr;
@@ -182,4 +182,6 @@ char *strchr (const char *s, int c_in)
return NULL;
}
libc_hidden_def(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
strong_alias(strchr,index)
+#endif
diff --git a/libc/string/generic/strchrnul.c b/libc/string/generic/strchrnul.c
index e699a6dfa..17e32ab44 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)
@@ -41,8 +42,8 @@ char *strchrnul (const char *s, int c_in)
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = s; ((unsigned long int) char_ptr
- & (sizeof (longword) - 1)) != 0;
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
++char_ptr)
if (*char_ptr == c || *char_ptr == '\0')
return (void *) char_ptr;
@@ -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/strncmp.c b/libc/string/generic/strncmp.c
index 4c1978439..12e0e4d17 100644
--- a/libc/string/generic/strncmp.c
+++ b/libc/string/generic/strncmp.c
@@ -65,4 +65,4 @@ int strncmp (const char *s1, const char *s2, size_t n)
return c1 - c2;
}
-libc_hidden_def(strncmp)
+libc_hidden_weak(strncmp)
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/strrchr.c b/libc/string/generic/strrchr.c
index b67e369fd..97192da95 100644
--- a/libc/string/generic/strrchr.c
+++ b/libc/string/generic/strrchr.c
@@ -43,4 +43,6 @@ char *strrchr (const char *s, int c)
return (char *) found;
}
libc_hidden_def(strrchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
strong_alias(strrchr,rindex)
+#endif
diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c
index 7b34e2c16..5cb1779d2 100644
--- a/libc/string/generic/strsep.c
+++ b/libc/string/generic/strsep.c
@@ -18,10 +18,12 @@
#include <string.h>
-libc_hidden_proto(strsep)
+#ifdef __USE_BSD
+
libc_hidden_proto(strchr)
libc_hidden_proto(strpbrk)
+libc_hidden_proto(strsep)
char *strsep (char **stringp, const char *delim)
{
char *begin, *end;
@@ -66,3 +68,4 @@ char *strsep (char **stringp, const char *delim)
return begin;
}
libc_hidden_def(strsep)
+#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. */