LCOV - code coverage report
Current view: top level - ccan/str - str.c (source / functions) Hit Total Coverage
Test: skiboot.info Lines: 6 6 100.0 %
Date: 2024-01-02 21:04:04 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* CC0 (Public domain) - see LICENSE file for details */
       2                 :            : #include <ccan/str/str.h>
       3                 :            : 
       4                 :        149 : size_t strcount(const char *haystack, const char *needle)
       5                 :            : {
       6                 :        149 :         size_t i = 0, nlen = strlen(needle);
       7                 :            : 
       8                 :        236 :         while ((haystack = strstr(haystack, needle)) != NULL) {
       9                 :         87 :                 i++;
      10                 :         87 :                 haystack += nlen;
      11                 :            :         }
      12                 :        149 :         return i;
      13                 :            : }

Generated by: LCOV version 1.14