| 107 | } |
| 108 | |
| 109 | static int cte_occurrences(const char *text, const char *needle) { |
| 110 | int count = 0; |
| 111 | size_t needle_len = strlen(needle); |
| 112 | const char *cursor = text; |
| 113 | while ((cursor = strstr(cursor, needle)) != NULL) { |
| 114 | ++count; |
| 115 | cursor += needle_len; |
| 116 | } |
| 117 | return count; |
| 118 | } |
| 119 | |
| 120 | static int cte_replace_once(const char *source, const char *needle, const char *replacement, |
| 121 | char *output, size_t output_size) { |
no outgoing calls
no test coverage detected