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