X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ffile_analysis.c;h=530416e368cb1fd17a48f93fa7c9bc220b0f1a20;hp=e8c8ebc6dbb057f24849a6edd541c5c6cfda028d;hb=caf366998b97b7cc29bc1f33c285feb2f5d33bff;hpb=e169f82bbe459c6cfb80d5180f3ceb61a66a52ed diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c index e8c8ebc6..530416e3 100644 --- a/tools/ccanlint/file_analysis.c +++ b/tools/ccanlint/file_analysis.c @@ -135,10 +135,7 @@ static void add_files(struct manifest *m, const char *dir) is_c_src = strends(f->name, ".c"); if (!is_c_src && !strends(f->name, ".h")) { dest = &m->other_files; - continue; - } - - if (!strchr(f->name, '/')) { + } else if (!strchr(f->name, '/')) { if (is_c_src) dest = &m->c_files; else @@ -256,16 +253,17 @@ struct manifest *get_manifest(const void *ctx, const char *dir) /* We expect the ccan dir to be two levels above module dir. */ if (!ccan_dir) { - char *p; - ccan_dir = talloc_strdup(NULL, m->dir); - p = strrchr(ccan_dir, '/'); + char *p, *dir; + dir = talloc_strdup(NULL, m->dir); + p = strrchr(dir, '/'); if (!p) errx(1, "I expect the ccan root directory in ../.."); *p = '\0'; - p = strrchr(ccan_dir, '/'); + p = strrchr(dir, '/'); if (!p) errx(1, "I expect the ccan root directory in ../.."); *p = '\0'; + ccan_dir = dir; } add_files(m, ""); @@ -364,7 +362,7 @@ bool get_token(const char **line, const char *token) unsigned int toklen; *line += strspn(*line, " \t"); - if (isalnum(token[0]) || token[0] == '_') + if (cisalnum(token[0]) || token[0] == '_') toklen = strspn(*line, IDENT_CHARS); else { /* FIXME: real tokenizer handles ++ and other multi-chars. */