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