1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-30 00:00:15 +01:00
libhermit/usr/rdma-core/ccan/str.c
2017-10-06 15:13:04 +02:00

13 lines
283 B
C

/* CC0 (Public domain) - see LICENSE.CC0 file for details */
#include <ccan/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;
}