X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Fcompulsory_tests%2Fhas_main_header.c;h=bce6ef485a2b448778e0aefd69742e426ce243b7;hb=83cfe17fd85efb7f5d8e8b1edb1f3c28b180a2ce;hp=eb74e9f0101b016a577e98218428cd4e7e97cff6;hpb=fb4c4c3ddc24772f71a64ec02d2c9ddaeb6e9f6b;p=ccan diff --git a/tools/ccanlint/compulsory_tests/has_main_header.c b/tools/ccanlint/compulsory_tests/has_main_header.c index eb74e9f0..bce6ef48 100644 --- a/tools/ccanlint/compulsory_tests/has_main_header.c +++ b/tools/ccanlint/compulsory_tests/has_main_header.c @@ -12,35 +12,31 @@ #include #include -static void *check_has_main_header(struct manifest *m, - bool keep, - unsigned int *timeleft) +static void check_has_main_header(struct manifest *m, + bool keep, + unsigned int *timeleft, struct score *score) { struct ccan_file *f; list_for_each(&m->h_files, f, list) { if (strstarts(f->name, m->basename) - && strlen(f->name) == strlen(m->basename) + 2) - return NULL; + && strlen(f->name) == strlen(m->basename) + 2) { + score->pass = true; + score->score = score->total; + return; + } } - return m; -} - -static const char *describe_has_main_header(struct manifest *m, - void *check_result) -{ - return talloc_asprintf(m, + score->error = talloc_asprintf(score, "You have no %s/%s.h header file.\n\n" "CCAN modules have a name, the same as the directory name. They're\n" "expected to have an interface in the header of the same name.\n", - m->basename, m->basename); + m->basename, m->basename); } struct ccanlint has_main_header = { .key = "has-main-header", .name = "Module has main header file", .check = check_has_main_header, - .describe = describe_has_main_header, }; REGISTER_TEST(has_main_header, NULL);