X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fhas_examples.c;h=bfb298f2773c390dc8f7088f074a5e3d82051ad6;hp=d5f32795af44ef20da241b5f4b8453e52be0b35b;hb=ab4a6fd9a3b417456ccd8f1fb976783683ccaa26;hpb=0f66da713a750c995bb59452a95f4a71fdd8a58c diff --git a/tools/ccanlint/tests/has_examples.c b/tools/ccanlint/tests/has_examples.c index d5f32795..bfb298f2 100644 --- a/tools/ccanlint/tests/has_examples.c +++ b/tools/ccanlint/tests/has_examples.c @@ -24,12 +24,16 @@ static char *add_example(struct manifest *m, struct ccan_file *source, int fd; struct ccan_file *f; - name = maybe_temp_file(m, ".c", keep, - talloc_asprintf(m, "%s/example-%s-%s.c", - talloc_dirname(m, - source->fullname), - source->name, - example->function)); + name = talloc_asprintf(m, "%s/example-%s-%s.c", + talloc_dirname(m, + source->fullname), + source->name, + example->function); + /* example->function == 'struct foo' */ + while (strchr(name, ' ')) + *strchr(name, ' ') = '_'; + + name = maybe_temp_file(m, ".c", keep, name); f = new_ccan_file(m, talloc_dirname(m, name), talloc_basename(m, name)); talloc_steal(f, name); list_add_tail(&m->examples, &f->list);