c6d234
commit 8667f90ec51aa88146dce815a9105daf23d9bd07
c6d234
Author: Will Newton <will.newton@linaro.org>
c6d234
Date:   Mon Mar 31 13:47:56 2014 +0100
c6d234
c6d234
    string: Cosmetic cleanup of string functions
c6d234
    
c6d234
    Clean up string functions that do not have a version in gnulib on
c6d234
    the assumption that glibc is the canonical upstream copy of this
c6d234
    code. basename has a copy in gnulib but it is largely written to
c6d234
    handle Windows paths so merging it is not really viable. The changes
c6d234
    mostly consist of switching to ANSI function prototypes and removing
c6d234
    unused includes.
c6d234
    
c6d234
    As many of these functions do not get built in a typical build due
c6d234
    to architecture optimized versions being used instead I built these
c6d234
    by hand to verify there were no build warnings and the code was
c6d234
    identical.
c6d234
    
c6d234
    2014-04-07  Will Newton  <will.newton@linaro.org>
c6d234
    
c6d234
            * string/basename.c [HAVE_CONFIG_H]: Remove #ifdef and
c6d234
            and contents.  [!_LIBC] Remove #ifndef and contents.
c6d234
            (basename): Use ANSI prototype.  [_LIBC] Remove #idef.
c6d234
            * string/memccpy.c (__memccpy): Use ANSI prototype.
c6d234
            * string/memfrob.c (memfrob): Likewise.
c6d234
            * string/strcoll.c (STRCOLL): Likewise.
c6d234
            * string/strlen.c (strlen): Likewise.
c6d234
            * string/strtok.c (STRTOK): Likewise.
c6d234
            * string/strcat.c: Remove unused #include of memcopy.h.
c6d234
            (strcat): Use ANSI prototype.
c6d234
            * string/strchr.c: Remove unused #include of memcopy.h.
c6d234
            (strchr): Use ANSI prototype.
c6d234
            * string/strcmp.c: Remove unused #include of memcopy.h.
c6d234
            (strcmp): Use ANSI prototype.
c6d234
            * string/strcpy.c: Remove unused #include of memcopy.h.
c6d234
            (strcpy): Use ANSI prototype.
c6d234
c6d234
Conflicts:
c6d234
	string/strcat.c
c6d234
	string/strchr.c
c6d234
	string/strcmp.c
c6d234
	string/strlen.c
c6d234
c6d234
Textual conflicts due to previous backports in glibc-rh1268008-*.patch.
c6d234
c6d234
diff --git a/string/basename.c b/string/basename.c
c6d234
index c42b81c70fc761be..37fcebc56685e596 100644
c6d234
--- a/string/basename.c
c6d234
+++ b/string/basename.c
c6d234
@@ -16,26 +16,12 @@
c6d234
    License along with the GNU C Library; if not, see
c6d234
    <http://www.gnu.org/licenses/>.  */
c6d234
 
c6d234
-#ifdef HAVE_CONFIG_H
c6d234
-# include <config.h>
c6d234
-#endif
c6d234
-
c6d234
 #include <string.h>
c6d234
 
c6d234
-#ifndef _LIBC
c6d234
-/* We cannot generally use the name `basename' since XPG defines an unusable
c6d234
-   variant of the function but we cannot use it.  */
c6d234
-# define basename gnu_basename
c6d234
-#endif
c6d234
-
c6d234
-
c6d234
 char *
c6d234
-basename (filename)
c6d234
-     const char *filename;
c6d234
+basename (const char *filename)
c6d234
 {
c6d234
   char *p = strrchr (filename, '/');
c6d234
   return p ? p + 1 : (char *) filename;
c6d234
 }
c6d234
-#ifdef _LIBC
c6d234
 libc_hidden_def (basename)
c6d234
-#endif
c6d234
diff --git a/string/memccpy.c b/string/memccpy.c
c6d234
index 64c3c0196845f102..b2e4e399b75b5d84 100644
c6d234
--- a/string/memccpy.c
c6d234
+++ b/string/memccpy.c
c6d234
@@ -28,11 +28,7 @@
c6d234
    Return the position in DEST one byte past where C was copied, or
c6d234
    NULL if C was not found in the first N bytes of SRC.  */
c6d234
 void *
c6d234
-__memccpy (dest, src, c, n)
c6d234
-      void *dest;
c6d234
-      const void *src;
c6d234
-      int c;
c6d234
-      size_t n;
c6d234
+__memccpy (void *dest, const void *src, int c, size_t n)
c6d234
 {
c6d234
   const char *s = src;
c6d234
   char *d = dest;
c6d234
diff --git a/string/memfrob.c b/string/memfrob.c
c6d234
index 6ef996ce3f70b642..320fae7e850dd05c 100644
c6d234
--- a/string/memfrob.c
c6d234
+++ b/string/memfrob.c
c6d234
@@ -18,9 +18,7 @@
c6d234
 #include <string.h>
c6d234
 
c6d234
 void *
c6d234
-memfrob (s, n)
c6d234
-     void *s;
c6d234
-     size_t n;
c6d234
+memfrob (void *s, size_t n)
c6d234
 {
c6d234
   char *p = (char *) s;
c6d234
 
c6d234
diff --git a/string/strcat.c b/string/strcat.c
c6d234
index 017bb41ebb490fbc..1ed18b5015e00a72 100644
c6d234
--- a/string/strcat.c
c6d234
+++ b/string/strcat.c
c6d234
@@ -16,7 +16,6 @@
c6d234
    <http://www.gnu.org/licenses/>.  */
c6d234
 
c6d234
 #include <string.h>
c6d234
-#include <memcopy.h>
c6d234
 
c6d234
 #undef strcat
c6d234
 
c6d234
diff --git a/string/strchr.c b/string/strchr.c
c6d234
index 69a9cd9b1bdd7368..9ca5bcd3496a5ee9 100644
c6d234
--- a/string/strchr.c
c6d234
+++ b/string/strchr.c
c6d234
@@ -22,7 +22,6 @@
c6d234
    <http://www.gnu.org/licenses/>.  */
c6d234
 
c6d234
 #include <string.h>
c6d234
-#include <memcopy.h>
c6d234
 #include <stdlib.h>
c6d234
 
c6d234
 #undef strchr
c6d234
diff --git a/string/strcmp.c b/string/strcmp.c
c6d234
index 47fd2827ad9d64cf..cc96a99f7bb6ebcd 100644
c6d234
--- a/string/strcmp.c
c6d234
+++ b/string/strcmp.c
c6d234
@@ -16,7 +16,6 @@
c6d234
    <http://www.gnu.org/licenses/>.  */
c6d234
 
c6d234
 #include <string.h>
c6d234
-#include <memcopy.h>
c6d234
 
c6d234
 #undef strcmp
c6d234
 
c6d234
@@ -28,9 +27,7 @@
c6d234
    greater than zero if S1 is lexicographically less than,
c6d234
    equal to or greater than S2.  */
c6d234
 int
c6d234
-STRCMP (p1, p2)
c6d234
-     const char *p1;
c6d234
-     const char *p2;
c6d234
+STRCMP (const char *p1, const char *p2)
c6d234
 {
c6d234
   const unsigned char *s1 = (const unsigned char *) p1;
c6d234
   const unsigned char *s2 = (const unsigned char *) p2;
c6d234
diff --git a/string/strcoll.c b/string/strcoll.c
c6d234
index 02cb61e8e4f45d81..80a62f37d8640325 100644
c6d234
--- a/string/strcoll.c
c6d234
+++ b/string/strcoll.c
c6d234
@@ -29,9 +29,7 @@
c6d234
 
c6d234
 
c6d234
 int
c6d234
-STRCOLL (s1, s2)
c6d234
-     const STRING_TYPE *s1;
c6d234
-     const STRING_TYPE *s2;
c6d234
+STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2)
c6d234
 {
c6d234
   return STRCOLL_L (s1, s2, _NL_CURRENT_LOCALE);
c6d234
 }
c6d234
diff --git a/string/strcpy.c b/string/strcpy.c
c6d234
index 22467bb88dc8cef8..f726d6bd8993271c 100644
c6d234
--- a/string/strcpy.c
c6d234
+++ b/string/strcpy.c
c6d234
@@ -17,15 +17,12 @@
c6d234
 
c6d234
 #include <stddef.h>
c6d234
 #include <string.h>
c6d234
-#include <memcopy.h>
c6d234
 
c6d234
 #undef strcpy
c6d234
 
c6d234
 /* Copy SRC to DEST.  */
c6d234
 char *
c6d234
-strcpy (dest, src)
c6d234
-     char *dest;
c6d234
-     const char *src;
c6d234
+strcpy (char *dest, const char *src)
c6d234
 {
c6d234
   char c;
c6d234
   char *s = (char *) src;