1
0
Fork 0
libnvme/ccan/ccan/str/str.c
Daniel Baumann 336fe81026
Adding upstream version 1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-15 08:44:15 +01: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;
}