patch-1.3.12 linux/lib/string.c

Next file: linux/net/802/tr.c
Previous file: linux/kernel/sched.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.11/linux/lib/string.c linux/lib/string.c
@@ -12,9 +12,11 @@
  */
  
 #include <linux/types.h>
+#include <linux/string.h>
 
 char * ___strtok = NULL;
 
+#ifndef __HAVE_ARCH_STRCPY
 char * strcpy(char * dest,const char *src)
 {
 	char *tmp = dest;
@@ -23,7 +25,9 @@
 		/* nothing */;
 	return tmp;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRNCPY
 char * strncpy(char * dest,const char *src,size_t count)
 {
 	char *tmp = dest;
@@ -33,7 +37,9 @@
 
 	return tmp;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRCAT
 char * strcat(char * dest, const char * src)
 {
 	char *tmp = dest;
@@ -45,7 +51,9 @@
 
 	return tmp;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRNCAT
 char * strncat(char *dest, const char *src, size_t count)
 {
 	char *tmp = dest;
@@ -61,7 +69,9 @@
 
 	return tmp;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRCMP
 int strcmp(const char * cs,const char * ct)
 {
 	register signed char __res;
@@ -73,7 +83,9 @@
 
 	return __res;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRNCMP
 int strncmp(const char * cs,const char * ct,size_t count)
 {
 	register signed char __res = 0;
@@ -86,7 +98,9 @@
 
 	return __res;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRCHR
 char * strchr(const char * s,char c)
 {
 	for(; *s != c; ++s)
@@ -94,7 +108,9 @@
 			return NULL;
 	return (char *) s;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRLEN
 size_t strlen(const char * s)
 {
 	const char *sc;
@@ -103,7 +119,9 @@
 		/* nothing */;
 	return sc - s;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRNLEN
 size_t strnlen(const char * s, size_t count)
 {
 	const char *sc;
@@ -112,7 +130,9 @@
 		/* nothing */;
 	return sc - s;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRSPN
 size_t strspn(const char *s, const char *accept)
 {
 	const char *p;
@@ -131,7 +151,9 @@
 
 	return count;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRPBRK
 char * strpbrk(const char * cs,const char * ct)
 {
 	const char *sc1,*sc2;
@@ -144,7 +166,9 @@
 	}
 	return NULL;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRTOK
 char * strtok(char * s,const char * ct)
 {
 	char *sbegin, *send;
@@ -164,7 +188,9 @@
 	___strtok = send;
 	return (sbegin);
 }
+#endif
 
+#ifndef __HAVE_ARCH_MEMSET
 void * memset(void * s,char c,size_t count)
 {
 	char *xs = (char *) s;
@@ -174,7 +200,9 @@
 
 	return s;
 }
+#endif
 
+#ifndef __HAVE_ARCH_BCOPY
 char * bcopy(const char * src, char * dest, int count)
 {
 	char *tmp = dest;
@@ -184,7 +212,9 @@
 
 	return dest;
 }
+#endif
 
+#ifndef __HAVE_ARCH_MEMCPY
 void * memcpy(void * dest,const void *src,size_t count)
 {
 	char *tmp = (char *) dest, *s = (char *) src;
@@ -194,7 +224,9 @@
 
 	return dest;
 }
+#endif
 
+#ifndef __HAVE_ARCH_MEMMOVE
 void * memmove(void * dest,const void *src,size_t count)
 {
 	char *tmp, *s;
@@ -214,7 +246,9 @@
 
 	return dest;
 }
+#endif
 
+#ifndef __HAVE_ARCH_MEMCMP
 int memcmp(const void * cs,const void * ct,size_t count)
 {
 	const unsigned char *su1, *su2;
@@ -225,10 +259,12 @@
 			break;
 	return res;
 }
+#endif
 
 /*
  * find the first occurrence of byte 'c', or 1 past the area if none
  */
+#ifndef __HAVE_ARCH_MEMSCAN
 void * memscan(void * addr, unsigned char c, size_t size)
 {
 	unsigned char * p = (unsigned char *) addr;
@@ -241,7 +277,9 @@
 	}
   	return (void *) p;
 }
+#endif
 
+#ifndef __HAVE_ARCH_STRSTR
 char * strstr(const char * s1,const char * s2)
 {
 	int l1, l2;
@@ -258,3 +296,4 @@
 	}
 	return NULL;
 }
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this