X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ffile_analysis.c;h=9513ab67d7c0b6fe821362218cf0666520f9cf30;hb=f3505f82c0fdc9daac85d2cb2c6338a0292033e7;hp=d9f03dacfed94702e61a0ae0fa54e7b3f9c32e3a;hpb=9965fc25fcc92dc76d1cd4cf9595dc3dc9ebc586;p=ccan diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c index d9f03dac..9513ab67 100644 --- a/tools/ccanlint/file_analysis.c +++ b/tools/ccanlint/file_analysis.c @@ -1,10 +1,9 @@ #include "ccanlint.h" -#include "get_file_lines.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -24,6 +23,15 @@ char **get_ccan_file_lines(struct ccan_file *f) return f->lines; } +struct list_head *get_ccan_file_docs(struct ccan_file *f) +{ + if (!f->doc_sections) { + get_ccan_file_lines(f); + f->doc_sections = extract_doc_sections(f->lines, f->num_lines); + } + return f->doc_sections; +} + static void add_files(struct manifest *m, const char *dir) { DIR *d; @@ -47,6 +55,7 @@ static void add_files(struct manifest *m, const char *dir) f = talloc(m, struct ccan_file); f->lines = NULL; + f->doc_sections = NULL; f->name = talloc_asprintf(f, "%s%s", dir, ent->d_name); if (lstat(f->name, &st) != 0) err(1, "lstat %s", f->name); @@ -76,7 +85,9 @@ static void add_files(struct manifest *m, const char *dir) dest = &m->h_files; } else if (strstarts(f->name, "test/")) { if (is_c_src) { - if (strstarts(f->name, "test/run")) + if (strstarts(f->name, "test/api")) + dest = &m->api_tests; + else if (strstarts(f->name, "test/run")) dest = &m->run_tests; else if (strstarts(f->name, "test/compile_ok")) dest = &m->compile_ok_tests; @@ -126,6 +137,7 @@ struct manifest *get_manifest(void) m->info_file = NULL; list_head_init(&m->c_files); list_head_init(&m->h_files); + list_head_init(&m->api_tests); list_head_init(&m->run_tests); list_head_init(&m->compile_ok_tests); list_head_init(&m->compile_fail_tests);