X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ffile_analysis.c;h=63d22b8f129513420101f618f459ed4878a34c54;hp=91eb10a7253e5f1de93211bfd8ad4b890834d9c8;hb=13911ef769824a0958e1f1ce7292dfc8f23feb18;hpb=b931f4765272d68de3b5e35d70c1933c27bcdea4 diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c index 91eb10a7..63d22b8f 100644 --- a/tools/ccanlint/file_analysis.c +++ b/tools/ccanlint/file_analysis.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "../tools.h" #include #include @@ -39,7 +40,8 @@ static bool dir_cmp(const struct manifest *m, const char *dir) return strcmp(m->dir, dir) == 0; } -HTABLE_DEFINE_TYPE(struct manifest, manifest_name, dir_hash, dir_cmp, manifest); +HTABLE_DEFINE_TYPE(struct manifest, manifest_name, dir_hash, dir_cmp, + htable_manifest); static struct htable_manifest *manifests; const char *get_ccan_file_contents(struct ccan_file *f) @@ -74,6 +76,7 @@ struct list_head *get_ccan_file_docs(struct ccan_file *f) struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name) { struct ccan_file *f; + unsigned int i; assert(dir[0] == '/'); @@ -81,11 +84,11 @@ struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name) f->lines = NULL; f->line_info = NULL; f->doc_sections = NULL; - f->compiled[COMPILE_NORMAL] = f->compiled[COMPILE_NOFEAT] = NULL; + for (i = 0; i < ARRAY_SIZE(f->compiled); i++) + f->compiled[i] = NULL; f->name = talloc_steal(f, name); f->fullname = talloc_asprintf(f, "%s/%s", dir, f->name); f->contents = NULL; - f->cov_compiled = NULL; f->simplified = NULL; return f; } @@ -209,8 +212,10 @@ struct manifest *get_manifest(const void *ctx, const char *dir) unsigned int len; struct list_head *list; - if (!manifests) - manifests = htable_manifest_new(); + if (!manifests) { + manifests = talloc(NULL, struct htable_manifest); + htable_manifest_init(manifests); + } olddir = talloc_getcwd(NULL); if (!olddir)