| 172 | } |
| 173 | |
| 174 | char *cbm_str_replace_char(CBMArena *a, const char *s, char from, char to) { |
| 175 | if (!s) { |
| 176 | return NULL; |
| 177 | } |
| 178 | size_t len = strlen(s); |
| 179 | char *result = (char *)cbm_arena_alloc(a, len + SKIP_ONE); |
| 180 | if (!result) { |
| 181 | return NULL; |
| 182 | } |
| 183 | for (size_t i = 0; i < len; i++) { |
| 184 | result[i] = (s[i] == from) ? to : s[i]; |
| 185 | } |
| 186 | result[len] = '\0'; |
| 187 | return result; |
| 188 | } |
| 189 | |
| 190 | char *cbm_str_strip_ext(CBMArena *a, const char *path) { |
| 191 | if (!path) { |
no test coverage detected