[uClibc-cvs] uClibc/libc/string Makefile,1.51,1.52 wstring.c,1.14,1.15
Manuel Novoa III
mjn3 at uclibc.org
Mon Jun 16 04:50:13 UTC 2003
Update of /var/cvs/uClibc/libc/string
In directory winder:/tmp/cvs-serv26844/libc/string
Modified Files:
Makefile wstring.c
Log Message:
Add memmem().
Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/libc/string/Makefile,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- Makefile 20 Dec 2002 19:26:33 -0000 1.51
+++ Makefile 16 Jun 2003 04:50:09 -0000 1.52
@@ -33,7 +33,7 @@
strspn.o strstr.o strtok.o strtok_r.o strerror.o _susv3_strerror_r.o \
_string_syserrmsgs.o _glibc_strerror_r.o \
_string_syssigmsgs.o sys_siglist.o strsignal.o psignal.o \
- __xpg_basename.o strlcat.o strlcpy.o sys_errlist.o
+ __xpg_basename.o strlcat.o strlcpy.o sys_errlist.o memmem.o
MOBJW2= wcscasecmp.o wcscat.o wcschrnul.o wcschr.o wcscmp.o wcscpy.o wcscspn.o \
wcsdup.o wcslen.o wcsncasecmp.o wcsncat.o wcsncmp.o wcsncpy.o \
Index: wstring.c
===================================================================
RCS file: /var/cvs/uClibc/libc/string/wstring.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- wstring.c 3 Mar 2003 14:32:22 -0000 1.14
+++ wstring.c 16 Jun 2003 04:50:09 -0000 1.15
@@ -1462,6 +1462,40 @@
#endif
/**********************************************************************/
+#ifdef L_memmem
+
+void *memmem(const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen)
+{
+ register const char *ph;
+ register const char *pn;
+ const char *plast;
+ size_t n;
+
+ if (needlelen == 0) {
+ return (void *) haystack;
+ }
+
+ if (haystacklen >= needlelen) {
+ ph = (const char *) haystack;
+ pn = (const char *) needle;
+ plast = ph + (haystacklen - needlelen);
+
+ do {
+ n = 0;
+ while (ph[n] == pn[n]) {
+ if (++n == needlelen) {
+ return (void *) ph;
+ }
+ }
+ } while (++ph <= plast);
+ }
+
+ return NULL;
+}
+
+#endif
+/**********************************************************************/
#ifdef L_wmempcpy
#define L_mempcpy
#define Wmempcpy wmempcpy
More information about the uClibc-cvs
mailing list