projects
/
ccan
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
timer: handle time going backwards.
[ccan]
/
ccan
/
str
/
str.c
1
/* CC0 (Public domain) - see LICENSE file for details */
2
#include <ccan/str/str.h>
3
4
size_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
}