4 * Find a byte string inside a longer byte string
6 * This uses the "Not So Naive" algorithm, a very simple but
7 * usually effective algorithm, see:
9 * http://www-igm.univ-mlv.fr/~lecroq/string/
14 void *memmem(const void *haystack
, size_t n
, const void *needle
, size_t m
)
16 const unsigned char *y
= (const unsigned char *)haystack
;
17 const unsigned char *x
= (const unsigned char *)needle
;
37 if ( !memcmp(x
+2, y
+j
+2, m
-2) && x
[0] == y
[j
] )