]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/headers_idempotent.c
tools: use tal/path instead of writing own path handlers.
[ccan] / tools / ccanlint / tests / headers_idempotent.c
index f23784e4a2870c4b93cb9f7813aeb3b1d60464ef..d7c890916b1f541037bc50ace35ee10cdf0aa533 100644 (file)
@@ -1,6 +1,5 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -46,19 +45,19 @@ static void handle_idem(struct manifest *m, struct score *score)
                /* Main header gets CCAN_FOO_H, others CCAN_FOO_XXX_H */
                if (strstarts(e->file->name, m->basename)
                    || strlen(e->file->name) == strlen(m->basename) + 2)
-                       name = talloc_asprintf(score, "CCAN_%s_H", m->basename);
+                       name = tal_fmt(score, "CCAN_%s_H", m->modname);
                else
-                       name = talloc_asprintf(score, "CCAN_%s_%s",
-                                              m->basename, e->file->name);
+                       name = tal_fmt(score, "CCAN_%s_%s",
+                                      m->modname, e->file->name);
                fix_name(name);
 
-               q = talloc_asprintf(score,
+               q = tal_fmt(score,
                            "Should I wrap %s in #ifndef/#define %s for you?",
                            e->file->name, name);
                if (!ask(q))
                        continue;
 
-               tmpname = maybe_temp_file(score, ".h", false, e->file->name);
+               tmpname = temp_file(score, ".h", e->file->name);
                out = fopen(tmpname, "w");
                if (!out)
                        err(1, "Opening %s", tmpname);
@@ -174,7 +173,6 @@ static void check_idem(struct ccan_file *f, struct score *score)
 }
 
 static void check_idempotent(struct manifest *m,
-                            bool keep,
                             unsigned int *timeleft, struct score *score)
 {
        struct ccan_file *f;
@@ -195,7 +193,7 @@ struct ccanlint headers_idempotent = {
        .name = "Module headers are #ifndef/#define wrapped",
        .check = check_idempotent,
        .handle = handle_idem,
-       .needs = ""
+       .needs = "info_exists main_header_exists"
 };
 
 REGISTER_TEST(headers_idempotent);