summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/generic/strcmp.c8
-rw-r--r--libc/string/wstring.c88
2 files changed, 48 insertions, 48 deletions
diff --git a/libc/string/generic/strcmp.c b/libc/string/generic/strcmp.c
index 2af550d81..c8212f04b 100644
--- a/libc/string/generic/strcmp.c
+++ b/libc/string/generic/strcmp.c
@@ -23,10 +23,6 @@
#undef strcmp
-#ifdef __LOCALE_C_ONLY
-weak_alias(strcmp,strcoll);
-#endif /* __LOCALE_C_ONLY */
-
/* 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. */
@@ -50,3 +46,7 @@ strcmp (p1, p2)
return c1 - c2;
}
+
+#ifdef __LOCALE_C_ONLY
+weak_alias(strcmp,strcoll);
+#endif /* __LOCALE_C_ONLY */
diff --git a/libc/string/wstring.c b/libc/string/wstring.c
index 6f54ae615..c9c8548fb 100644
--- a/libc/string/wstring.c
+++ b/libc/string/wstring.c
@@ -612,10 +612,6 @@ Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
#ifdef L_memcmp
-#ifndef L_wmemcmp
-weak_alias(memcmp,bcmp);
-#endif
-
int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
{
register const Wuchar *r1 = (const Wuchar *) s1;
@@ -638,6 +634,10 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
#endif
}
+#ifndef L_wmemcmp
+weak_alias(memcmp,bcmp);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcscmp
@@ -649,14 +649,6 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
#ifdef L_strcmp
-#ifdef __LOCALE_C_ONLY
-#ifdef L_wcscmp
-weak_alias(wcscmp,wcscoll);
-#else /* L_wcscmp */
-weak_alias(strcmp,strcoll);
-#endif /* L_wcscmp */
-#endif /* __LOCALE_C_ONLY */
-
int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
{
#ifdef WANT_WIDE
@@ -677,6 +669,15 @@ int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
return r;
#endif
}
+
+#ifdef __LOCALE_C_ONLY
+#ifdef L_wcscmp
+weak_alias(wcscmp,wcscoll);
+#else /* L_wcscmp */
+weak_alias(strcmp,strcoll);
+#endif /* L_wcscmp */
+#endif /* __LOCALE_C_ONLY */
+
#endif
/**********************************************************************/
#ifdef L_wcsncmp
@@ -756,10 +757,6 @@ Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
#ifdef L_strchr
-#ifndef L_wcschr
-weak_alias(strchr,index);
-#endif
-
Wchar *Wstrchr(register const Wchar *s, Wint c)
{
do {
@@ -771,6 +768,10 @@ Wchar *Wstrchr(register const Wchar *s, Wint c)
return NULL;
}
+#ifndef L_wcschr
+weak_alias(strchr,index);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcscspn
@@ -830,10 +831,6 @@ Wchar *Wstrpbrk(const Wchar *s1, const Wchar *s2)
#ifdef L_strrchr
-#ifndef L_wcsrchr
-weak_alias(strrchr,rindex);
-#endif
-
Wchar *Wstrrchr(register const Wchar *s, Wint c)
{
register const Wchar *p;
@@ -848,6 +845,10 @@ Wchar *Wstrrchr(register const Wchar *s, Wint c)
return (Wchar *) p; /* silence the warning */
}
+#ifndef L_wcsrchr
+weak_alias(strrchr,rindex);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_wcsspn
@@ -886,10 +887,6 @@ size_t Wstrspn(const Wchar *s1, const Wchar *s2)
/* NOTE: This is the simple-minded O(len(s1) * len(s2)) worst-case approach. */
-#ifdef L_wcsstr
-weak_alias(wcsstr,wcswcs);
-#endif
-
Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
{
register const Wchar *s = s1;
@@ -912,6 +909,10 @@ Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
} while (1);
}
+#ifdef L_wcsstr
+weak_alias(wcsstr,wcswcs);
+#endif
+
#endif
/**********************************************************************/
#undef Wstrspn
@@ -930,10 +931,6 @@ Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
#ifdef L_strtok_r
-#ifndef L_wcstok
-weak_alias(__strtok_r,strtok_r);
-#endif
-
Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2,
Wchar ** __restrict next_start)
{
@@ -967,6 +964,10 @@ Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2,
#endif
}
+#ifndef L_wcstok
+weak_alias(__strtok_r,strtok_r);
+#endif
+
#endif
/**********************************************************************/
/* #ifdef L_wcstok */
@@ -1571,8 +1572,6 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
/**********************************************************************/
#ifdef L___glibc_strerror_r
-weak_alias(__glibc_strerror_r,__strerror_r);
-
char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
{
__xpg_strerror_r(errnum, strerrbuf, buflen);
@@ -1580,6 +1579,7 @@ char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
return strerrbuf;
}
+weak_alias(__glibc_strerror_r,__strerror_r);
#endif
/**********************************************************************/
#ifdef L_memmem
@@ -1625,10 +1625,6 @@ void *memmem(const void *haystack, size_t haystacklen,
#ifdef L_mempcpy
-#ifndef L_wmempcpy
-weak_alias(__mempcpy,mempcpy);
-#endif
-
Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
{
register Wchar *r1 = s1;
@@ -1648,6 +1644,10 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
return r1;
}
+#ifndef L_wmempcpy
+weak_alias(__mempcpy,mempcpy);
+#endif
+
#endif
/**********************************************************************/
#ifdef L_memrchr
@@ -1737,7 +1737,6 @@ Wchar *Wstpncpy(register Wchar * __restrict s1,
/**********************************************************************/
#ifdef L_bzero
-weak_alias(__bzero,bzero);
void __bzero(void *s, size_t n)
{
register unsigned char *p = s;
@@ -1753,6 +1752,7 @@ void __bzero(void *s, size_t n)
--np;
}
}
+weak_alias(__bzero,bzero);
#undef np
#endif
@@ -1902,15 +1902,13 @@ char *strsep(char ** __restrict s1, const char * __restrict s2)
#ifdef L_strchrnul
-extern Wchar *__Wstrchrnul(register const Wchar *s, Wint c);
-weak_alias(__Wstrchrnul, Wstrchrnul);
-
Wchar *__Wstrchrnul(register const Wchar *s, Wint c)
{
--s;
while (*++s && (*s != ((Wchar)c)));
return (Wchar *) s;
}
+weak_alias(__Wstrchrnul, Wstrchrnul);
#endif
/**********************************************************************/
@@ -2069,18 +2067,12 @@ extern size_t __wcslcpy(wchar_t *__restrict dst,
#ifdef L___wcslcpy
#define L_strlcpy
#define Wstrlcpy __wcslcpy
-#ifdef __LOCALE_C_ONLY
-weak_alias(__wcslcpy,wcsxfrm);
-#endif
#endif
#ifdef L_strlcpy
#ifndef L___wcslcpy
#define Wstrlcpy strlcpy
-#ifdef __LOCALE_C_ONLY
-weak_alias(strlcpy,strxfrm);
-#endif
#endif
/* OpenBSD function:
@@ -2111,6 +2103,14 @@ size_t Wstrlcpy(register Wchar *__restrict dst,
return src - src0;
}
+#ifdef __LOCALE_C_ONLY
+#ifdef L___wcslcpy
+weak_alias(__wcslcpy,wcsxfrm);
+#else
+weak_alias(strlcpy,strxfrm);
+#endif
+#endif
+
#endif
/**********************************************************************/
#if defined(L__string_syssigmsgs) && defined(__UCLIBC_HAS_SIGNUM_MESSAGES__)