Turn any whitespace into a single space. */
| 18 | |
| 19 | /* Turn any whitespace into a single space. */ |
| 20 | static char *canonicalize(char *str) |
| 21 | { |
| 22 | char *to = str, *from = str; |
| 23 | bool have_space = true; |
| 24 | |
| 25 | while (*from) { |
| 26 | if (cisspace(*from)) { |
| 27 | if (!have_space) |
| 28 | *(to++) = ' '; |
| 29 | have_space = true; |
| 30 | } else { |
| 31 | *(to++) = *from; |
| 32 | have_space = false; |
| 33 | } |
| 34 | from++; |
| 35 | } |
| 36 | if (have_space && to != str) |
| 37 | to--; |
| 38 | *to = '\0'; |
| 39 | tal_resize(&str, to + 1 - str); |
| 40 | return str; |
| 41 | } |
| 42 | |
| 43 | static bool get_files(const char *dir, const char *subdir, |
| 44 | struct bolt_file **files) |
no test coverage detected