1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-29 21:47:30 +03:00
Rusty Russell ed349eabd9 lib/ccan/str: relicense to public domain.
LGPL is overkill for trivial wrappers like this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 942f2788e165bb203b0f160f29bd4592f32dc344)
2011-12-05 16:42:45 +10:30

13 lines
226 B
C

#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;
}