historical/m0-applesillicon.git/xnu-qemu-arm64-5.1.0/roms/skiboot/ccan/str/str.c
2024-01-16 11:20:27 -06:00

13 lines
283 B
C

/* CC0 (Public domain) - see LICENSE file for details */
#include <ccan/str/str.h>
size_t strcount(const char *haystack, const char *needle)
{
size_t i = 0, nlen = strlen(needle);
while ((haystack = strstr(haystack, needle)) != NULL) {
i++;
haystack += nlen;
}
return i;
}