about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/crypt.h2
-rw-r--r--sysdeps/generic/memccpy.c11
-rw-r--r--sysdeps/generic/memchr.c5
-rw-r--r--sysdeps/generic/memcmp.c2
-rw-r--r--sysdeps/generic/memmem.c1
-rw-r--r--sysdeps/generic/memmove.c2
-rw-r--r--sysdeps/generic/mempcpy.c66
-rw-r--r--sysdeps/generic/strcat.c2
-rw-r--r--sysdeps/generic/strchr.c2
-rw-r--r--sysdeps/generic/strcmp.c4
-rw-r--r--sysdeps/generic/strcpy.c2
-rw-r--r--sysdeps/generic/strcspn.c2
-rw-r--r--sysdeps/generic/strlen.c2
-rw-r--r--sysdeps/generic/strncat.c2
-rw-r--r--sysdeps/generic/strncmp.c4
-rw-r--r--sysdeps/generic/strncpy.c1
-rw-r--r--sysdeps/generic/strpbrk.c2
-rw-r--r--sysdeps/generic/strrchr.c4
-rw-r--r--sysdeps/generic/strsep.c2
-rw-r--r--sysdeps/generic/strspn.c1
-rw-r--r--sysdeps/generic/strstr.c2
-rw-r--r--sysdeps/generic/strtok.c2
-rw-r--r--sysdeps/generic/strtok_r.c1
-rw-r--r--sysdeps/generic/sysd-stdio.c33
24 files changed, 120 insertions, 37 deletions
diff --git a/sysdeps/generic/crypt.h b/sysdeps/generic/crypt.h
index 3f8f960140..c14554c829 100644
--- a/sysdeps/generic/crypt.h
+++ b/sysdeps/generic/crypt.h
@@ -50,6 +50,8 @@ struct crypt_data
     int direction, initialized;
   };
 
+extern char *__crypt_r __P ((__const char *__key, __const char *__salt,
+			     struct crypt_data *__data));
 extern char *crypt_r __P ((__const char *__key, __const char *__salt,
 			   struct crypt_data *__data));
 #endif
diff --git a/sysdeps/generic/memccpy.c b/sysdeps/generic/memccpy.c
index 6d85a791c6..44a874a954 100644
--- a/sysdeps/generic/memccpy.c
+++ b/sysdeps/generic/memccpy.c
@@ -18,11 +18,12 @@
 
 #include <string.h>
 
-/*
- * Copy no more than N bytes of SRC to DEST, stopping when C is found.
- * Return the position in DEST one byte past where C was copied,
- * or NULL if C was not found in the first N bytes of SRC.
- */
+#undef __memccpy
+#undef memccpy
+
+/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
+   Return the position in DEST one byte past where C was copied, or
+   NULL if C was not found in the first N bytes of SRC.  */
 void *
 __memccpy (dest, src, c, n)
       void *dest; const void *src;
diff --git a/sysdeps/generic/memchr.c b/sysdeps/generic/memchr.c
index 60276e9942..c8926c7b38 100644
--- a/sysdeps/generic/memchr.c
+++ b/sysdeps/generic/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997 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);
@@ -47,9 +47,10 @@
 
 #include <sys/types.h>
 
+#undef memchr
 
-/* Search no more than N bytes of S for C.  */
 
+/* Search no more than N bytes of S for C.  */
 __ptr_t
 memchr (s, c, n)
      const __ptr_t s;
diff --git a/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c
index 9dac13fc91..8fa371192c 100644
--- a/sysdeps/generic/memcmp.c
+++ b/sysdeps/generic/memcmp.c
@@ -34,6 +34,8 @@
 #include <string.h>
 #endif
 
+#undef memcmp
+
 #ifdef _LIBC
 
 #include <memcopy.h>
diff --git a/sysdeps/generic/memmem.c b/sysdeps/generic/memmem.c
index 8163709686..9e4e342237 100644
--- a/sysdeps/generic/memmem.c
+++ b/sysdeps/generic/memmem.c
@@ -19,6 +19,7 @@
 #include <stddef.h>
 #include <string.h>
 
+#undef memmem
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
 void *
diff --git a/sysdeps/generic/memmove.c b/sysdeps/generic/memmove.c
index f4a900973d..4115aa31c7 100644
--- a/sysdeps/generic/memmove.c
+++ b/sysdeps/generic/memmove.c
@@ -29,12 +29,14 @@
 #define	a1const
 #define	a2	src	/* Second arg is SRC.  */
 #define	a2const	const
+#undef memmove
 #endif
 #if	!defined(RETURN) || !defined(rettype)
 #define	RETURN(s)	return (s)	/* Return DEST.  */
 #define	rettype		void *
 #endif
 
+
 rettype
 memmove (a1, a2, len)
      a1const void *a1;
diff --git a/sysdeps/generic/mempcpy.c b/sysdeps/generic/mempcpy.c
new file mode 100644
index 0000000000..43873405c5
--- /dev/null
+++ b/sysdeps/generic/mempcpy.c
@@ -0,0 +1,66 @@
+/* Copy memory to memory until the specified number of bytes
+   has been copied, return pointer to following byte.
+   Overlap is NOT handled correctly.
+   Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Torbjorn Granlund (tege@sics.se).
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <string.h>
+#include <memcopy.h>
+#include <pagecopy.h>
+
+#undef mempcpy
+
+void *
+__mempcpy (dstpp, srcpp, len)
+     void *dstpp;
+     const void *srcpp;
+     size_t len;
+{
+  unsigned long int dstp = (long int) dstpp;
+  unsigned long int srcp = (long int) srcpp;
+
+  /* Copy from the beginning to the end.  */
+
+  /* If there not too few bytes to copy, use word copy.  */
+  if (len >= OP_T_THRES)
+    {
+      /* Copy just a few bytes to make DSTP aligned.  */
+      len -= (-dstp) % OPSIZ;
+      BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+      /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+	 as much as possible.  */
+
+      PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+      /* Copy from SRCP to DSTP taking advantage of the known alignment of
+	 DSTP.  Number of bytes remaining is put in the third argument,
+	 i.e. in LEN.  This number may vary from machine to machine.  */
+
+      WORD_COPY_FWD (dstp, srcp, len, len);
+
+      /* Fall out and copy the tail.  */
+    }
+
+  /* There are just a few bytes to copy.  Use byte memory operations.  */
+  BYTE_COPY_FWD (dstp, srcp, len);
+
+  return (void *) dstp;
+}
+weak_alias (__mempcpy, mempcpy)
diff --git a/sysdeps/generic/strcat.c b/sysdeps/generic/strcat.c
index 05abd01eff..d8dbab2192 100644
--- a/sysdeps/generic/strcat.c
+++ b/sysdeps/generic/strcat.c
@@ -19,6 +19,8 @@
 #include <string.h>
 #include <memcopy.h>
 
+#undef strcat
+
 /* Append SRC on the end of DEST.  */
 char *
 strcat (dest, src)
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
index d9e58a85a7..3663382556 100644
--- a/sysdeps/generic/strchr.c
+++ b/sysdeps/generic/strchr.c
@@ -22,9 +22,9 @@
 
 #include <string.h>
 
+#undef strchr
 
 /* Find the first occurrence of C in S.  */
-
 char *
 strchr (s, c)
      const char *s;
diff --git a/sysdeps/generic/strcmp.c b/sysdeps/generic/strcmp.c
index a8d9db1bc9..62e55f56ab 100644
--- a/sysdeps/generic/strcmp.c
+++ b/sysdeps/generic/strcmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997 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
@@ -19,6 +19,8 @@
 #include <string.h>
 #include <memcopy.h>
 
+#undef strcmp
+
 /* Compare S1 and S2, returning less than, equal to or
    greater than zero if S1 is lexicographically less than,
    equal to or greater than S2.  */
diff --git a/sysdeps/generic/strcpy.c b/sysdeps/generic/strcpy.c
index fc6beb27fd..cb260cf85a 100644
--- a/sysdeps/generic/strcpy.c
+++ b/sysdeps/generic/strcpy.c
@@ -20,6 +20,8 @@
 #include <string.h>
 #include <memcopy.h>
 
+#undef strcpy
+
 /* Copy SRC to DEST.  */
 char *
 strcpy (dest, src)
diff --git a/sysdeps/generic/strcspn.c b/sysdeps/generic/strcspn.c
index d7d59b250b..3630a13332 100644
--- a/sysdeps/generic/strcspn.c
+++ b/sysdeps/generic/strcspn.c
@@ -29,6 +29,8 @@
 # endif
 #endif
 
+#undef strcspn
+
 /* Return the length of the maximum initial segment of S
    which contains no characters from REJECT.  */
 size_t
diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c
index 37dc9ed20c..1fb8b1c97c 100644
--- a/sysdeps/generic/strlen.c
+++ b/sysdeps/generic/strlen.c
@@ -20,10 +20,10 @@
 
 #include <string.h>
 
+#undef strlen
 
 /* Return the length of the null-terminated string STR.  Scan for
    the null terminator quickly by testing four bytes at a time.  */
-
 size_t
 strlen (str)
      const char *str;
diff --git a/sysdeps/generic/strncat.c b/sysdeps/generic/strncat.c
index 1233f8b54b..ae9f5e1be3 100644
--- a/sysdeps/generic/strncat.c
+++ b/sysdeps/generic/strncat.c
@@ -24,6 +24,8 @@
 typedef char reg_char;
 #endif
 
+#undef strncat
+
 char *
 strncat (s1, s2, n)
      char *s1;
diff --git a/sysdeps/generic/strncmp.c b/sysdeps/generic/strncmp.c
index eea64389f8..6e5dabebcd 100644
--- a/sysdeps/generic/strncmp.c
+++ b/sysdeps/generic/strncmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997 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
@@ -19,6 +19,8 @@
 #include <string.h>
 #include <memcopy.h>
 
+#undef strncmp
+
 /* Compare no more than N characters of S1 and S2,
    returning less than, equal to or greater than zero
    if S1 is lexicographically less than, equal to or
diff --git a/sysdeps/generic/strncpy.c b/sysdeps/generic/strncpy.c
index 06f5cec2ed..24c7269b09 100644
--- a/sysdeps/generic/strncpy.c
+++ b/sysdeps/generic/strncpy.c
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <memcopy.h>
 
+#undef strncpy
 
 char *
 strncpy (s1, s2, n)
diff --git a/sysdeps/generic/strpbrk.c b/sysdeps/generic/strpbrk.c
index 3b533e1b87..a49d2b145b 100644
--- a/sysdeps/generic/strpbrk.c
+++ b/sysdeps/generic/strpbrk.c
@@ -24,6 +24,8 @@
 # include <string.h>
 #endif
 
+#undef strpbrk
+
 /* Find the first occurrence in S of any character in ACCEPT.  */
 char *
 strpbrk (s, accept)
diff --git a/sysdeps/generic/strrchr.c b/sysdeps/generic/strrchr.c
index db5549b922..98839ea4c4 100644
--- a/sysdeps/generic/strrchr.c
+++ b/sysdeps/generic/strrchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997 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
@@ -18,6 +18,8 @@
 
 #include <string.h>
 
+#undef strrchr
+
 /* Find the last occurrence of C in S.  */
 char *
 strrchr (const char *s, int c)
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
index b2c7e90c39..b5ea6ead9d 100644
--- a/sysdeps/generic/strsep.c
+++ b/sysdeps/generic/strsep.c
@@ -18,6 +18,8 @@
 
 #include <string.h>
 
+#undef strsep
+
 char *
 __strsep (char **stringp, const char *delim)
 {
diff --git a/sysdeps/generic/strspn.c b/sysdeps/generic/strspn.c
index 9d2fe63848..5f64a6f756 100644
--- a/sysdeps/generic/strspn.c
+++ b/sysdeps/generic/strspn.c
@@ -18,6 +18,7 @@
 
 #include <string.h>
 
+#undef strspn
 
 /* Return the length of the maximum initial segment
    of S which contains only characters in ACCEPT.  */
diff --git a/sysdeps/generic/strstr.c b/sysdeps/generic/strstr.c
index 85774d3491..03d6c8e5fc 100644
--- a/sysdeps/generic/strstr.c
+++ b/sysdeps/generic/strstr.c
@@ -36,6 +36,8 @@
 
 typedef unsigned chartype;
 
+#undef strstr
+
 char *
 strstr (phaystack, pneedle)
      const char *phaystack;
diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c
index 5eb0ee6f07..b366653cb3 100644
--- a/sysdeps/generic/strtok.c
+++ b/sysdeps/generic/strtok.c
@@ -21,6 +21,8 @@
 
 static char *olds = NULL;
 
+#undef strtok
+
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the last string strtok() was called with is
    used.  For example:
diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c
index 3b7d202a6c..44430dae40 100644
--- a/sysdeps/generic/strtok_r.c
+++ b/sysdeps/generic/strtok_r.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#undef strtok_r
 
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c
index f5147bb3aa..9818f84c5c 100644
--- a/sysdeps/generic/sysd-stdio.c
+++ b/sysdeps/generic/sysd-stdio.c
@@ -28,10 +28,7 @@
 
 /* Read N bytes into BUF from COOKIE.  */
 int
-__stdio_read (cookie, buf, n)
-     void *cookie;
-     register char *buf;
-     register size_t n;
+__stdio_read (void *cookie, char *buf, size_t n;)
 {
   const int fd = (int) cookie;
 #if	defined (EINTR) && defined (EINTR_REPEAT)
@@ -58,10 +55,7 @@ __stdio_read (cookie, buf, n)
 
 /* Write N bytes from BUF to COOKIE.  */
 int
-__stdio_write (cookie, buf, n)
-     void *cookie;
-     register const char *buf;
-     register size_t n;
+__stdio_write (void *cookie, const char *buf, size_t n)
 {
   const int fd = (int) cookie;
   register size_t written = 0;
@@ -92,10 +86,7 @@ __stdio_write (cookie, buf, n)
    The new file position is stored in *POS.
    Returns zero if successful, nonzero if not.  */
 int
-__stdio_seek (cookie, pos, whence)
-     void *cookie;
-     fpos_t *pos;
-     int whence;
+__stdio_seek (void *cookie, fpos_t *pos, int whence)
 {
   off_t new;
   new = __lseek ((int) cookie, (off_t) *pos, whence);
@@ -108,8 +99,7 @@ __stdio_seek (cookie, pos, whence)
 
 /* Close COOKIE.  */
 int
-__stdio_close (cookie)
-     void *cookie;
+__stdio_close (void *cookie)
 {
   return __close ((int) cookie);
 }
@@ -118,8 +108,7 @@ __stdio_close (cookie)
    or -1 for errors.  If COOKIE does not relate to any POSIX.1 file
    descriptor, this should return -1 with errno set to EOPNOTSUPP.  */
 int
-__stdio_fileno (cookie)
-     void *cookie;
+__stdio_fileno (void *cookie)
 {
   return (int) cookie;
 }
@@ -127,10 +116,7 @@ __stdio_fileno (cookie)
 
 /* Open the given file with the mode given in the __io_mode argument.  */
 int
-__stdio_open (filename, m, cookieptr)
-     const char *filename;
-     __io_mode m;
-     void **cookieptr;
+__stdio_open (const char *filename, __io_mode m, void **cookieptr)
 {
   int fd;
   int mode;
@@ -164,11 +150,8 @@ __stdio_open (filename, m, cookieptr)
 /* Open FILENAME with the mode in M.  Use the same magic cookie
    already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN.  */
 int
-__stdio_reopen (filename, m, cookieptr, closefn)
-     const char *filename;
-     __io_mode m;
-     void **cookieptr;
-     __io_close_fn closefn;
+__stdio_reopen (const char *filename, __io_mode m, void **cookieptr,
+		__io_close_fn closefn)
 {
   void *newcookie;