mirror of
https://github.com/samba-team/samba.git
synced 2025-01-29 21:47:30 +03:00
ed349eabd9
LGPL is overkill for trivial wrappers like this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 942f2788e165bb203b0f160f29bd4592f32dc344)
13 lines
226 B
C
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;
|
|
}
|