| 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 | } |
no outgoing calls