MCPcopy Create free account
hub / github.com/ElementsProject/lightning / memmem

Function memmem

ccan/ccan/mem/mem.c:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9#if !HAVE_MEMMEM
10void *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

Callers 6

get_http_hdrFunction · 0.85
http_headers_completeFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
rune_alt_singleFunction · 0.85
read_json_from_rpcFunction · 0.85

Calls

no outgoing calls

Tested by 2

mainFunction · 0.68
mainFunction · 0.68