aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/ccan/str/str.c
diff options
context:
space:
mode:
Diffstat (limited to 'roms/skiboot/ccan/str/str.c')
-rw-r--r--roms/skiboot/ccan/str/str.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/roms/skiboot/ccan/str/str.c b/roms/skiboot/ccan/str/str.c
new file mode 100644
index 000000000..a9245c174
--- /dev/null
+++ b/roms/skiboot/ccan/str/str.c
@@ -0,0 +1,13 @@
+/* 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;
+}