patch-2.2.11 linux/lib/string.c
Next file: linux/mm/memory.c
Previous file: linux/kernel/sysctl.c
Back to the patch index
Back to the overall index
- Lines: 18
- Date:
Mon Aug 9 12:05:45 1999
- Orig file:
v2.2.10/linux/lib/string.c
- Orig date:
Sun Sep 6 11:19:15 1998
diff -u --recursive --new-file v2.2.10/linux/lib/string.c linux/lib/string.c
@@ -339,3 +339,17 @@
return NULL;
}
#endif
+
+#ifndef __HAVE_ARCH_MEMCHR
+void *memchr(const void *s, int c, size_t n)
+{
+ const unsigned char *p = s;
+ while (n-- != 0) {
+ if ((unsigned char)c == *p++) {
+ return (void *)p-1;
+ }
+ }
+ return NULL;
+}
+
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)