Browse Source

Hide some of mem* and str*

Peter S. Mazinger 19 years ago
parent
commit
de77369cf4

+ 4 - 0
libc/inet/addr.c

@@ -16,6 +16,10 @@
  * Changed to use _int10tostr.
  */
 
+#define _uintmaxtostr __libc__uintmaxtostr
+/* for some reason this does not work here */
+#define memmove __memmove
+
 #define _GNU_SOURCE
 #define __FORCE_GLIBC
 #include <features.h>

+ 2 - 0
libc/inet/getaddrinfo.c

@@ -44,6 +44,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* This software is Copyright 1996 by Craig Metz, All Rights Reserved.  */
 
+#define memcpy __memcpy
+
 #define _GNU_SOURCE
 #define __FORCE_GLIBC
 #include <features.h>

+ 2 - 0
libc/inet/getproto.c

@@ -51,6 +51,8 @@
 ** SUCH DAMAGE.
 */
 
+#define strpbrk __strpbrk
+
 #define __FORCE_GLIBC
 #define _GNU_SOURCE
 #include <features.h>

+ 1 - 0
libc/inet/getservice.c

@@ -51,6 +51,7 @@
 ** SUCH DAMAGE.
 */
 
+#define strpbrk __strpbrk
 
 #define __FORCE_GLIBC
 #define _GNU_SOURCE

+ 2 - 0
libc/inet/ntop.c

@@ -15,6 +15,8 @@
  * SOFTWARE.
  */
 
+#define memmove __memmove
+
 #define __FORCE_GLIBC
 #include <features.h>
 #include <sys/param.h>

+ 5 - 0
libc/inet/resolv.c

@@ -133,6 +133,11 @@
  *
  */
 
+#define memmove __memmove
+#define strnlen __strnlen
+#define strncat __strncat
+#define strstr __strstr
+
 #define __FORCE_GLIBC
 #include <features.h>
 #include <string.h>

+ 2 - 0
libc/misc/error/error.c

@@ -22,6 +22,8 @@
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
 /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */
 
+#define strerror __strerror
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>

+ 2 - 0
libc/misc/ftw/ftw.c

@@ -18,6 +18,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define mempcpy __libc_mempcpy
+
 #define _GNU_SOURCE
 #include <features.h>
 

+ 3 - 0
libc/misc/glob/glob.c

@@ -15,6 +15,9 @@ License along with this library; see the file COPYING.LIB.  If
 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
+#define strrchr __strrchr
+#define strcoll __strcoll
+
 #include <features.h>
 #include <stdlib.h>
 #include <string.h>

+ 2 - 0
libc/misc/locale/locale.c

@@ -46,6 +46,8 @@
  *    locale support had (8-bit codesets only).
  */
 
+#define strtok_r __strtok_r
+
 #define _GNU_SOURCE
 
 #define __CTYPE_HAS_8_BIT_LOCALES 1

+ 3 - 0
libc/misc/mntent/mntent.c

@@ -1,3 +1,6 @@
+#define strtok_r __strtok_r
+#define strstr __strstr
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

+ 11 - 0
libc/misc/regex/regex.c

@@ -20,6 +20,14 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define HAVE_MEMPCPY
+#define __mempcpy __libc_mempcpy
+#define memset __memset
+#define memcmp __memcmp
+#define strcmp __strcmp
+#define strlen __strlen
+/* for some reason this does not work */
+#define memcpy __memcpy
 
 /* To exclude some unwanted junk.... */
 #undef _LIBC
@@ -30,6 +38,9 @@
 #include <string.h>
 #define STDC_HEADERS
 
+extern void *__libc_mempcpy (void *__restrict __dest,
+			__const void *__restrict __src, size_t __n) /*attribute_hidden*/;
+
 /* AIX requires this to be the first thing in the file. */
 #if defined _AIX && !defined REGEX_MALLOC
   #pragma alloca

+ 2 - 0
libc/misc/statfs/fstatvfs.c

@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define strsep __strsep
+
 #include <features.h>
 
 #define __USE_GNU

+ 2 - 0
libc/misc/statfs/fstatvfs64.c

@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define strsep __strsep
+
 #include <features.h>
 
 #ifdef __UCLIBC_HAS_LFS__

+ 2 - 0
libc/misc/statfs/statvfs.c

@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define strsep __strsep
+
 #include <features.h>
 
 #define __USE_GNU

+ 2 - 0
libc/misc/statfs/statvfs64.c

@@ -17,6 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define strsep __strsep
+
 #include <features.h>
 
 #ifdef __UCLIBC_HAS_LFS__

+ 2 - 0
libc/misc/syslog/syslog.c

@@ -31,6 +31,8 @@
  * SUCH DAMAGE.
  */
 
+#define memmove __memmove
+
 #define __FORCE_GLIBC
 #define _GNU_SOURCE
 #include <features.h>

+ 3 - 0
libc/misc/time/time.c

@@ -129,6 +129,9 @@
  *            differs (intentionally) from glibc's behavior.
  */
 
+#define _uintmaxtostr __libc__uintmaxtostr
+#define strnlen __strnlen
+
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>

+ 2 - 0
libc/misc/wchar/wchar.c

@@ -98,6 +98,8 @@
  * Manuel
  */
 
+#define memmove __memmove
+
 #define _GNU_SOURCE
 #define _ISOC99_SOURCE
 #include <errno.h>

+ 4 - 0
libc/misc/wordexp/wordexp.c

@@ -19,6 +19,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define mempcpy __libc_mempcpy
+#define strndup __strndup
+#define strspn __strspn
+
 #define _GNU_SOURCE
 #include <sys/cdefs.h>
 #include <sys/types.h>

+ 3 - 0
libc/stdio/_fwrite.c

@@ -5,6 +5,9 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
+#define memrchr __memrchr
+#define memchr __memchr
+
 #include "_stdio.h"
 
 #ifdef __STDIO_BUFFERS

+ 1 - 1
libc/stdio/_stdio.h

@@ -7,6 +7,7 @@
 
 #define _GNU_SOURCE
 
+#include <features.h>
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -17,7 +18,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <features.h>
 
 #ifdef __UCLIBC_HAS_WCHAR__
 #include <wchar.h>

+ 2 - 0
libc/stdio/_wfwrite.c

@@ -5,6 +5,8 @@
  * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
  */
 
+#define wmemcpy __wmemcpy
+
 #include "_stdio.h"
 #include <wchar.h>
 

+ 1 - 0
libc/stdio/old_vfprintf.c

@@ -128,6 +128,7 @@
 /**************************************************************************/
 
 #define _uintmaxtostr __libc__uintmaxtostr
+#define strnlen __strnlen
 
 #define _ISOC99_SOURCE			/* for ULLONG primarily... */
 #define _GNU_SOURCE				/* for strnlen */

+ 1 - 0
libc/stdio/vfprintf.c

@@ -89,6 +89,7 @@
  */
 
 #define _uintmaxtostr __libc__uintmaxtostr
+#define strnlen __strnlen
 
 #define _ISOC99_SOURCE			/* for ULLONG primarily... */
 #define _GNU_SOURCE

+ 2 - 0
libc/stdlib/ptsname.c

@@ -17,6 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define _uintmaxtostr __libc__uintmaxtostr
+
 #define _ISOC99_SOURCE
 #include <stdio.h>
 #include <errno.h>

+ 2 - 0
libc/stdlib/setenv.c

@@ -19,6 +19,8 @@
    modified for uClibc by Erik Andersen <andersen@codepoet.org>
    */
 
+#define strndup __strndup
+
 #define _GNU_SOURCE
 #include <features.h>
 #include <errno.h>

+ 2 - 0
libc/stdlib/unix_grantpt.c

@@ -17,6 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define memchr __memchr
+
 #include <assert.h>
 #include <errno.h>
 #include <grp.h>

+ 2 - 0
libc/string/generic/memmove.c

@@ -19,6 +19,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define memcpy __memcpy
+
 #include <string.h>
 
 #include "memcopy.h"

+ 2 - 0
libc/string/generic/strsep.c

@@ -16,6 +16,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define strpbrk __strpbrk
+
 #include <string.h>
 
 #undef strsep

+ 4 - 0
libc/string/generic/strtok_r.c

@@ -17,6 +17,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define rawmemchr __rawmemchr
+#define strspn __strspn
+#define strpbrk __strpbrk
+
 #define _GNU_SOURCE
 #include <string.h>
 

+ 2 - 2
libc/string/strtok_r.c

@@ -8,9 +8,9 @@
 #define Wstrtok_r __strtok_r
 
 #undef Wstrspn
-#define Wstrspn strspn
+#define Wstrspn __strspn
 #undef Wstrpbrk
-#define Wstrpbrk strpbrk
+#define Wstrpbrk __strpbrk
 
 #include "wstring.c"
 

+ 28 - 14
libc/string/wstring.c

@@ -26,7 +26,10 @@
  *  mapping of signal strings (alpha, mips, hppa, sparc).
  */
 
+#define _uintmaxtostr __libc__uintmaxtostr
+
 #define _GNU_SOURCE
+#include <features.h>
 #include <string.h>
 #include <strings.h>
 #include <stdio.h>
@@ -59,6 +62,17 @@ typedef unsigned char	__string_uchar_t;
 
 #endif
 
+
+extern void *__memcpy (void *__restrict __dest,
+		     __const void *__restrict __src, size_t __n) attribute_hidden;
+extern void *__memmove (void *__dest, __const void *__src, size_t __n) attribute_hidden;
+extern void *__memset (void *__s, int __c, size_t __n) attribute_hidden;
+extern int __memcmp (__const void *__s1, __const void *__s2, size_t __n) attribute_hidden;
+extern size_t __strnlen (__const char *__string, size_t __maxlen) attribute_hidden;
+extern char *__strpbrk (__const char *__s, __const char *__accept) attribute_hidden;
+extern size_t __strspn (__const char *__s, __const char *__accept) attribute_hidden;
+extern char *__strsignal (int __sig) attribute_hidden;
+
 /**********************************************************************/
 /* NOTE: If we ever do internationalized syserr messages, this will
  * have to be changed! */
@@ -1649,7 +1663,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
 #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
 
     s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown);
-    memcpy(s, unknown, sizeof(unknown));
+    __memcpy(s, unknown, sizeof(unknown));
 
  GOT_MESG:
     if (!strerrbuf) {		/* SUSv3  */
@@ -1662,7 +1676,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
     }
 
     if (i) {
-		memcpy(strerrbuf, s, i);
+		__memcpy(strerrbuf, s, i);
 		strerrbuf[i-1] = 0;	/* In case buf was too small. */
     }
 
@@ -1685,7 +1699,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
     };
 
     s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown);
-    memcpy(s, unknown, sizeof(unknown));
+    __memcpy(s, unknown, sizeof(unknown));
 
     if (!strerrbuf) {		/* SUSv3  */
 		buflen = 0;
@@ -1701,7 +1715,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
     }
 
     if (i) {
-		memcpy(strerrbuf, s, i);
+		__memcpy(strerrbuf, s, i);
 		strerrbuf[i-1] = 0;	/* In case buf was too small. */
     }
 
@@ -1914,7 +1928,7 @@ Wchar attribute_hidden *Wstpncpy(register Wchar * __restrict s1,
 void attribute_hidden __bzero(void *s, size_t n)
 {
 #if 1
-	(void)memset(s, 0, n);
+	(void)__memset(s, 0, n);
 #else
 	register unsigned char *p = s;
 #ifdef __BCC__
@@ -1945,7 +1959,7 @@ strong_alias(__bzero, bzero)
 void attribute_hidden __bcopy(const void *s2, void *s1, size_t n)
 {
 #if 1
-	memmove(s1, s2, n);
+	__memmove(s1, s2, n);
 #else
 #ifdef __BCC__
 	register char *s;
@@ -2043,10 +2057,10 @@ char attribute_hidden *__strndup(register const char *s1, size_t n)
 {
 	register char *s;
 
-	n = strnlen(s1,n);			/* Avoid problems if s1 not nul-terminated. */
+	n = __strnlen(s1,n);			/* Avoid problems if s1 not nul-terminated. */
 
     if ((s = malloc(n + 1)) != NULL) {
-		memcpy(s, s1, n);
+		__memcpy(s, s1, n);
 		s[n] = 0;
 	}
 
@@ -2067,7 +2081,7 @@ char attribute_hidden *__strsep(char ** __restrict s1, const char * __restrict s
 
 #if 1
 	p = NULL;
-	if (s && *s && (p = strpbrk(s, s2))) {
+	if (s && *s && (p = __strpbrk(s, s2))) {
 		*p++ = 0;
 	}
 #else
@@ -2504,7 +2518,7 @@ char attribute_hidden *__strsignal(int signum)
     }
 
     s = _int10tostr(buf+sizeof(buf)-1, signum) - sizeof(unknown);
-    memcpy(s, unknown, sizeof(unknown));
+    __memcpy(s, unknown, sizeof(unknown));
 
  DONE:
 	return s;
@@ -2519,7 +2533,7 @@ char attribute_hidden *__strsignal(int signum)
 		'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' '
     };
 
-    return (char *) memcpy(_int10tostr(buf+sizeof(buf)-1, signum)
+    return (char *) __memcpy(_int10tostr(buf+sizeof(buf)-1, signum)
 						   - sizeof(unknown),
 						   unknown, sizeof(unknown));
 }
@@ -2547,7 +2561,7 @@ void psignal(int signum, register const char *message)
 		message = (sep += 2);	/* or passed an empty string. */
 	}
 
-	fprintf(stderr, "%s%s%s\n", message, sep, strsignal(signum));
+	fprintf(stderr, "%s%s%s\n", message, sep, __strsignal(signum));
 }
 
 #endif
@@ -2674,7 +2688,7 @@ static int lookup(wchar_t wc   __LOCALE_PARAM )
 
 static void init_col_state(col_state_t *cs, const Wchar *wcs)
 {
-	memset(cs, 0, sizeof(col_state_t));
+	__memset(cs, 0, sizeof(col_state_t));
 	cs->s = wcs;
 	cs->bp = cs->back_buf = cs->ibb;
 	cs->bb_size = 128;
@@ -2906,7 +2920,7 @@ static void next_weight(col_state_t *cs, int pass   __LOCALE_PARAM )
 								cs->weight = 0;
 								return;
 							}
-							memcpy(cs->bp, cs->back_buf, cs->bb_size);
+							__memcpy(cs->bp, cs->back_buf, cs->bb_size);
 
 						} else {
 							cs->bp = realloc(cs->back_buf, cs->bb_size + 128);

+ 2 - 0
libc/termios/tcgetattr.c

@@ -16,6 +16,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define mempcpy __libc_mempcpy
+
 #include <features.h>
 #define __USE_GNU
 #include <string.h>

+ 2 - 0
libc/unistd/getsubopt.c

@@ -18,6 +18,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define memchr __memchr
+
 #include <stdlib.h>
 #include <string.h>