From d8ea341e64250c2f4636c559562e8904037eda74 Mon Sep 17 00:00:00 2001
From: Denis Vlasenko <vda.linux@googlemail.com>
Date: Wed, 26 Nov 2008 01:21:10 +0000
Subject: libc/string: need additional work to remove libc_hidden_proto's
 properly

---
 include/wchar.h             |  2 ++
 libc/misc/fnmatch/fnmatch.c |  4 ++--
 libc/string/memchr.c        |  2 --
 libc/string/memcpy.c        |  2 --
 libc/string/mempcpy.c       |  2 --
 libc/string/strcat.c        |  2 --
 libc/string/strchr.c        |  2 --
 libc/string/strchrnul.c     |  2 --
 libc/string/strcmp.c        |  3 ---
 libc/string/strcpy.c        |  9 ++++++---
 libc/string/strlcpy.c       | 21 ++++++++++-----------
 libc/string/strlen.c        |  2 --
 libc/string/strnlen.c       |  2 --
 libc/string/strpbrk.c       |  2 --
 libc/string/strspn.c        |  2 --
 15 files changed, 20 insertions(+), 39 deletions(-)

diff --git a/include/wchar.h b/include/wchar.h
index eb09cf9ea..5bf49b662 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -233,6 +233,7 @@ __BEGIN_NAMESPACE_C99
 /* Find the first occurrence of WC in WCS.  */
 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
+libc_hidden_proto(wcschr)
 /* Find the last occurrence of WC in WCS.  */
 extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
@@ -243,6 +244,7 @@ __END_NAMESPACE_C99
    the closing NUL wide character in case C is not found in S.  */
 extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
      __THROW __attribute_pure__;
+libc_hidden_proto(wcschrnul)
 #endif
 
 __BEGIN_NAMESPACE_C99
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c
index 2256cb84c..ed86fe861 100644
--- a/libc/misc/fnmatch/fnmatch.c
+++ b/libc/misc/fnmatch/fnmatch.c
@@ -90,8 +90,8 @@
 /* libc_hidden_proto(wmemchr) */
 /* libc_hidden_proto(wmempcpy) */
 /* libc_hidden_proto(wcscat) */
-/*libc_hidden_proto(wcschr)*/
-/*libc_hidden_proto(wcschrnul)*/
+/* libc_hidden_proto(wcschr) */
+/* libc_hidden_proto(wcschrnul) */
 /* libc_hidden_proto(wcslen) */
 /* libc_hidden_proto(wcscoll) */
 /* libc_hidden_proto(towlower) */
diff --git a/libc/string/memchr.c b/libc/string/memchr.c
index 413999722..5e60f6554 100644
--- a/libc/string/memchr.c
+++ b/libc/string/memchr.c
@@ -13,8 +13,6 @@
 # define Wmemchr memchr
 #endif
 
-libc_hidden_proto(Wmemchr)
-
 Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
 {
 	register const Wuchar *r = (const Wuchar *) s;
diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c
index dc2986778..aa8d4ee38 100644
--- a/libc/string/memcpy.c
+++ b/libc/string/memcpy.c
@@ -13,8 +13,6 @@
 # define Wmemcpy memcpy
 #endif
 
-libc_hidden_proto(Wmemcpy)
-
 Wvoid *Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
 {
 	register Wchar *r1 = s1;
diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c
index 91896434b..e7605146a 100644
--- a/libc/string/mempcpy.c
+++ b/libc/string/mempcpy.c
@@ -15,8 +15,6 @@
 # define Wmempcpy mempcpy
 #endif
 
-libc_hidden_proto(Wmempcpy)
-
 Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
 {
 	register Wchar *r1 = s1;
diff --git a/libc/string/strcat.c b/libc/string/strcat.c
index 40a9be111..63619bcc8 100644
--- a/libc/string/strcat.c
+++ b/libc/string/strcat.c
@@ -13,8 +13,6 @@
 # define Wstrcat strcat
 #endif
 
-libc_hidden_proto(Wstrcat)
-
 Wchar *Wstrcat(Wchar * __restrict s1, register const Wchar * __restrict s2)
 {
 	register Wchar *s = s1;
diff --git a/libc/string/strchr.c b/libc/string/strchr.c
index 329545e9f..462b7b1f1 100644
--- a/libc/string/strchr.c
+++ b/libc/string/strchr.c
@@ -13,8 +13,6 @@
 # define Wstrchr strchr
 #endif
 
-libc_hidden_proto(Wstrchr)
-
 Wchar *Wstrchr(register const Wchar *s, Wint c)
 {
 	do {
diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c
index 6fe7f6c3d..d2d7df307 100644
--- a/libc/string/strchrnul.c
+++ b/libc/string/strchrnul.c
@@ -15,8 +15,6 @@
 # define Wstrchrnul strchrnul
 #endif
 
-libc_hidden_proto(Wstrchrnul)
-
 Wchar *Wstrchrnul(register const Wchar *s, Wint c)
 {
 	--s;
diff --git a/libc/string/strcmp.c b/libc/string/strcmp.c
index 5477adf3a..abae61812 100644
--- a/libc/string/strcmp.c
+++ b/libc/string/strcmp.c
@@ -15,8 +15,6 @@
 # define Wstrcoll strcoll
 #endif
 
-libc_hidden_proto(Wstrcmp)
-
 int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
 {
 #ifdef WANT_WIDE
@@ -40,7 +38,6 @@ int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
 libc_hidden_def(Wstrcmp)
 
 #ifndef __UCLIBC_HAS_LOCALE__
-libc_hidden_proto(Wstrcoll)
 strong_alias(Wstrcmp,Wstrcoll)
 libc_hidden_def(Wstrcoll)
 #endif
diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c
index cda4094ac..568efbf60 100644
--- a/libc/string/strcpy.c
+++ b/libc/string/strcpy.c
@@ -13,8 +13,6 @@
 # define Wstrcpy strcpy
 #endif
 
-libc_hidden_proto(Wstrcpy)
-
 Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2)
 {
 	register Wchar *s = s1;
@@ -29,4 +27,9 @@ Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2)
 
 	return s1;
 }
-libc_hidden_def(Wstrcpy)
+
+#ifdef WANT_WIDE
+/* wcscpy does not need libc_hidden_def */
+#else
+libc_hidden_def(strcpy)
+#endif
diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c
index 4bdf0daa6..0ccfc0e8a 100644
--- a/libc/string/strlcpy.c
+++ b/libc/string/strlcpy.c
@@ -9,14 +9,10 @@
 
 #ifdef WANT_WIDE
 # define Wstrlcpy __wcslcpy
-# define Wstrxfrm wcsxfrm
 #else
-/* Experimentally off - libc_hidden_proto(strlcpy) */
 # define Wstrlcpy strlcpy
-# define Wstrxfrm strxfrm
 #endif
 
-
 /* OpenBSD function:
  * Copy at most n-1 chars from src to dst and nul-terminate dst.
  * Returns strlen(src), so truncation occurred if the return value is >= n. */
@@ -49,16 +45,19 @@ size_t Wstrlcpy(register Wchar *__restrict dst,
 
 	return src - src0;
 }
-#ifndef WANT_WIDE
-libc_hidden_def(strlcpy)
+#ifdef WANT_WIDE
+
 #ifndef __UCLIBC_HAS_LOCALE__
-/* Experimentally off - libc_hidden_proto(strxfrm) */
-strong_alias(strlcpy,strxfrm)
-libc_hidden_def(strxfrm)
+strong_alias(__wcslcpy,wcsxfrm)
+libc_hidden_def(wcsxfrm)
 #endif
+
 #else
+
+libc_hidden_def(strlcpy)
 #ifndef __UCLIBC_HAS_LOCALE__
-strong_alias(__wcslcpy,wcsxfrm)
-libc_hidden_def(wcsxfrm)
+strong_alias(strlcpy,strxfrm)
+libc_hidden_def(strxfrm)
 #endif
+
 #endif
diff --git a/libc/string/strlen.c b/libc/string/strlen.c
index 2edb6e4e8..021a8cabc 100644
--- a/libc/string/strlen.c
+++ b/libc/string/strlen.c
@@ -13,8 +13,6 @@
 # define Wstrlen strlen
 #endif
 
-libc_hidden_proto(Wstrlen)
-
 size_t Wstrlen(const Wchar *s)
 {
 	register const Wchar *p;
diff --git a/libc/string/strnlen.c b/libc/string/strnlen.c
index 8fbc25c11..98267e51b 100644
--- a/libc/string/strnlen.c
+++ b/libc/string/strnlen.c
@@ -15,8 +15,6 @@
 # define Wstrnlen strnlen
 #endif
 
-libc_hidden_proto(Wstrnlen)
-
 size_t Wstrnlen(const Wchar *s, size_t max)
 {
 	register const Wchar *p = s;
diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c
index abeb84380..ddfc75172 100644
--- a/libc/string/strpbrk.c
+++ b/libc/string/strpbrk.c
@@ -13,8 +13,6 @@
 # define Wstrpbrk strpbrk
 #endif
 
-libc_hidden_proto(Wstrpbrk)
-
 Wchar *Wstrpbrk(const Wchar *s1, const Wchar *s2)
 {
 	register const Wchar *s;
diff --git a/libc/string/strspn.c b/libc/string/strspn.c
index ca83ef900..942b6f308 100644
--- a/libc/string/strspn.c
+++ b/libc/string/strspn.c
@@ -13,8 +13,6 @@
 # define Wstrspn strspn
 #endif
 
-libc_hidden_proto(Wstrspn)
-
 size_t Wstrspn(const Wchar *s1, const Wchar *s2)
 {
 	register const Wchar *s = s1;
-- 
cgit v1.2.3