patch-2.3.23 linux/include/asm-arm/string.h

Next file: linux/include/asm-arm/system.h
Previous file: linux/include/asm-arm/shmparam.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.22/linux/include/asm-arm/string.h linux/include/asm-arm/string.h
@@ -2,7 +2,8 @@
 #define __ASM_ARM_STRING_H
 
 /*
- * inline versions, hmm...
+ * We don't do inline string functions, since the
+ * optimised inline asm versions are not small.
  */
 
 #define __HAVE_ARCH_STRRCHR
@@ -13,13 +14,25 @@
 
 #define __HAVE_ARCH_MEMCPY
 #define __HAVE_ARCH_MEMMOVE
-#define __HAVE_ARCH_MEMSET
 #define __HAVE_ARCH_MEMCHR
-
 #define __HAVE_ARCH_MEMZERO
-extern void memzero(void *ptr, int n);
+#define __HAVE_ARCH_MEMSET
+
+extern void __memzero(void *ptr, __kernel_size_t n);
+extern void __memset(void *ptr, int v, __kernel_size_t n);
+
+#define memset(p,v,n)							\
+	({								\
+		if ((n) != 0) {						\
+			if (__builtin_constant_p((v)) && (v) == 0)	\
+				__memzero((p),(n));			\
+			else						\
+				__memset((p),(v),(n));			\
+		}							\
+		(p);							\
+	})
 
-extern void memsetl (unsigned long *, unsigned long, int n);
+#define memzero(p,n) ({ if ((n) != 0) __memzero((p),(n)); (p); })
 
 #endif
  

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)