projects
/
ccan
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
str: strcount
[ccan]
/
ccan
/
str
/
str.c
1
#include <ccan/str/str.h>
2
3
size_t strcount(const char *haystack, const char *needle)
4
{
5
size_t i = 0, nlen = strlen(needle);
6
7
while ((haystack = strstr(haystack, needle)) != NULL) {
8
i++;
9
haystack += nlen;
10
}
11
return i;
12
}