source:
trunk/sys/dietlibc/memmem.c
@
428
Last change on this file since 428 was 1, checked in by , 8 years ago | |
---|---|
File size: 307 bytes |
Rev | Line | |
---|---|---|
[1] | 1 | #define _GNU_SOURCE 23 |
2 | #include <sys/types.h> | |
3 | #include <string.h> | |
4 | ||
5 | void *memmem(const void* haystack, size_t hl, const void* needle, size_t nl) { | |
6 | int i; | |
7 | if (nl>hl) return 0; | |
8 | for (i=hl-nl+1; i; --i) { | |
9 | if (!memcmp(haystack,needle,nl)) | |
10 | return (char*)haystack; | |
11 | ++haystack; | |
12 | } | |
13 | return 0; | |
14 | } |
Note: See TracBrowser
for help on using the repository browser.