X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fdepends_accurate.c;h=34db4f84d0dd75b9d402f7ead9bc798cdf88268b;hb=73650a939e3abdf495fd3ca6bd5fea695e28a089;hp=943fa350e09b3a8d6bc8ffc10c990f3e12e4a8d7;hpb=51a56b52627e635566253a3fae081c3f466b6bb6;p=ccan-lca-2011.git diff --git a/tools/ccanlint/tests/depends_accurate.c b/tools/ccanlint/tests/depends_accurate.c index 943fa35..34db4f8 100644 --- a/tools/ccanlint/tests/depends_accurate.c +++ b/tools/ccanlint/tests/depends_accurate.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -15,19 +16,6 @@ #include #include -static char *strip_spaces(const void *ctx, char *line) -{ - char *p = talloc_strdup(ctx, line); - unsigned int i, j; - - for (i = 0, j = 0; p[i]; i++) { - if (!isspace(p[i])) - p[j++] = p[i]; - } - p[j] = '\0'; - return p; -} - static bool has_dep(struct manifest *m, const char *depname) { struct manifest *i; @@ -60,18 +48,12 @@ static void check_depends_accurate(struct manifest *m, char **lines = get_ccan_file_lines(f); for (i = 0; lines[i]; i++) { - char *p; - if (lines[i][strspn(lines[i], " \t")] != '#') - continue; - p = strip_spaces(f, lines[i]); - if (!strstarts(p, "#includeerror = "Includes a ccan module" " not listed in _info"; @@ -87,9 +69,10 @@ static void check_depends_accurate(struct manifest *m, } struct ccanlint depends_accurate = { - .key = "depends-accurate", - .name = "Module's CCAN dependencies are the only ccan files #included", + .key = "depends_accurate", + .name = "Module's CCAN dependencies are the only CCAN files #included", .check = check_depends_accurate, + .needs = "depends_exist" }; -REGISTER_TEST(depends_accurate, &depends_exist, NULL); +REGISTER_TEST(depends_accurate);