about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--sysdeps/generic/memccpy.c5
-rw-r--r--sysdeps/generic/memchr.c12
-rw-r--r--sysdeps/generic/rawmemchr.c12
-rw-r--r--sysdeps/generic/strchr.c10
-rw-r--r--sysdeps/generic/strchrnul.c8
6 files changed, 39 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index b217fd6f47..e2a5873274 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 1999-06-13  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
 
+	* sysdeps/generic/strchr.c: Include <memcopy.h> and use reg_char
+	for character to search, to help the compiler.
+	* sysdeps/generic/strchrnul.c: Likewise.
+	* sysdeps/generic/memchr.c: Likewise.
+	* sysdeps/generic/memccpy.c: Likewise.
+	* sysdeps/generic/rawmemchr.c: Likewise.  Fix comment.
+
+1999-06-13  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
 	* sysdeps/m68k/memchr.S: New file.
 	* sysdeps/m68k/rawmemchr.S: New file.
 	* sysdeps/m68k/strchr.S: New file.
diff --git a/sysdeps/generic/memccpy.c b/sysdeps/generic/memccpy.c
index 44a874a954..f7b496de9f 100644
--- a/sysdeps/generic/memccpy.c
+++ b/sysdeps/generic/memccpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1997, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <string.h>
+#include <memcopy.h>
 
 #undef __memccpy
 #undef memccpy
@@ -31,7 +32,7 @@ __memccpy (dest, src, c, n)
 {
   register const char *s = src;
   register char *d = dest;
-  register const int x = (unsigned char) c;
+  register const reg_char x = (unsigned char) c;
   register size_t i = n;
 
   while (i-- > 0)
diff --git a/sysdeps/generic/memchr.c b/sysdeps/generic/memchr.c
index c8926c7b38..9ea9ce25c8 100644
--- a/sysdeps/generic/memchr.c
+++ b/sysdeps/generic/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
    with help from Dan Sahlin (dan@sics.se) and
    commentary by Jim Blandy (jimb@ai.mit.edu);
@@ -33,6 +33,9 @@
 
 #if defined (_LIBC)
 # include <string.h>
+# include <memcopy.h>
+#else
+# define reg_char char
 #endif
 
 #if defined (HAVE_LIMITS_H) || defined (_LIBC)
@@ -52,16 +55,17 @@
 
 /* Search no more than N bytes of S for C.  */
 __ptr_t
-memchr (s, c, n)
+memchr (s, c_in, n)
      const __ptr_t s;
-     int c;
+     int c_in;
      size_t n;
 {
   const unsigned char *char_ptr;
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
+  unsigned reg_char c;
 
-  c = (unsigned char) c;
+  c = (unsigned char) c_in;
 
   /* Handle the first few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */
diff --git a/sysdeps/generic/rawmemchr.c b/sysdeps/generic/rawmemchr.c
index c205968668..e874dca22b 100644
--- a/sysdeps/generic/rawmemchr.c
+++ b/sysdeps/generic/rawmemchr.c
@@ -33,6 +33,9 @@
 
 #if defined (_LIBC)
 # include <string.h>
+# include <memcopy.h>
+#else
+# define reg_char char
 #endif
 
 #if defined (HAVE_LIMITS_H) || defined (_LIBC)
@@ -50,17 +53,18 @@
 #undef memchr
 
 
-/* Search no more than N bytes of S for C.  */
+/* Find the first occurrence of C in S.  */
 __ptr_t
-__rawmemchr (s, c)
+__rawmemchr (s, c_in)
      const __ptr_t s;
-     int c;
+     int c_in;
 {
   const unsigned char *char_ptr;
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
+  unsigned reg_char c;
 
-  c = (unsigned char) c;
+  c = (unsigned char) c_in;
 
   /* Handle the first few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
index 7c1eb9578a..11039063d5 100644
--- a/sysdeps/generic/strchr.c
+++ b/sysdeps/generic/strchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 94, 95, 96, 97, 99 Free Software Foundation, Inc.
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
    with help from Dan Sahlin (dan@sics.se) and
    bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
@@ -21,20 +21,22 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <string.h>
+#include <memcopy.h>
 
 #undef strchr
 
 /* Find the first occurrence of C in S.  */
 char *
-strchr (s, c)
+strchr (s, c_in)
      const char *s;
-     int c;
+     int c_in;
 {
   const unsigned char *char_ptr;
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
+  unsigned reg_char c;
 
-  c = (unsigned char) c;
+  c = (unsigned char) c_in;
 
   /* Handle the first few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */
diff --git a/sysdeps/generic/strchrnul.c b/sysdeps/generic/strchrnul.c
index 1d6ece5332..b88fecba6d 100644
--- a/sysdeps/generic/strchrnul.c
+++ b/sysdeps/generic/strchrnul.c
@@ -21,21 +21,23 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <string.h>
+#include <memcopy.h>
 
 #undef __strchrnul
 #undef strchrnul
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 char *
-__strchrnul (s, c)
+__strchrnul (s, c_in)
      const char *s;
-     int c;
+     int c_in;
 {
   const unsigned char *char_ptr;
   const unsigned long int *longword_ptr;
   unsigned long int longword, magic_bits, charmask;
+  unsigned reg_char c;
 
-  c = (unsigned char) c;
+  c = (unsigned char) c_in;
 
   /* Handle the first few characters by reading one character at a time.
      Do this until CHAR_PTR is aligned on a longword boundary.  */