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

Function strcount

ccan/ccan/str/str.c:4–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <ccan/str/str.h>
3
4size_t strcount(const char *haystack, const char *needle)
5{
6 size_t i = 0, nlen = strlen(needle);
7
8 while ((haystack = strstr(haystack, needle)) != NULL) {
9 i++;
10 haystack += nlen;
11 }
12 return i;
13}

Callers 4

mainFunction · 0.85
path_relFunction · 0.85
count_open_bracesFunction · 0.85
db_prepare_untranslatedFunction · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68