| 8 | |
| 9 | #if !HAVE_MEMMEM |
| 10 | void *memmem(const void *haystack, size_t haystacklen, |
| 11 | const void *needle, size_t needlelen) |
| 12 | { |
| 13 | const char *p; |
| 14 | |
| 15 | if (needlelen > haystacklen) |
| 16 | return NULL; |
| 17 | |
| 18 | p = haystack; |
| 19 | |
| 20 | for (p = haystack; |
| 21 | (p + needlelen) <= ((const char *)haystack + haystacklen); |
| 22 | p++) |
| 23 | if (memcmp(p, needle, needlelen) == 0) |
| 24 | return (void *)p; |
| 25 | |
| 26 | return NULL; |
| 27 | } |
| 28 | #endif |
| 29 | |
| 30 | #if !HAVE_MEMRCHR |
no outgoing calls