MCPcopy Create free account
hub / github.com/ElementsProject/lightning / canonicalize

Function canonicalize

tools/check-bolt.c:20–41  ·  view source on GitHub ↗

Turn any whitespace into a single space. */

Source from the content-addressed store, hash-verified

18
19/* Turn any whitespace into a single space. */
20static 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
43static bool get_files(const char *dir, const char *subdir,
44 struct bolt_file **files)

Callers 2

get_filesFunction · 0.85
code_to_regexFunction · 0.85

Calls 1

cisspaceFunction · 0.85

Tested by

no test coverage detected