]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/info_exists.c
ccanlint: Move ccanlint test options from _info comments to code
[ccan] / tools / ccanlint / tests / info_exists.c
index a667c0817e4e0c9cb10dcaa2ba7918f1a8526f2b..8f01946f7ff018dfaa01d0acdf6e17d8f2e86cdb 100644 (file)
@@ -1,4 +1,6 @@
 #include <tools/ccanlint/ccanlint.h>
+#include <ccan/tal/tal.h>
+#include <ccan/tal/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <err.h>
 #include <string.h>
 #include <ccan/noerr/noerr.h>
-#include <ccan/talloc/talloc.h>
 
 static void check_has_info(struct manifest *m,
-                          unsigned int *timeleft,
+                          unsigned int *timeleft UNNEEDED,
                           struct score *score)
 {
        if (m->info_file) {
                score->pass = true;
                score->score = score->total;
-               add_info_options(m->info_file);
+               add_info_options(m);
        } else {
-               score->error = talloc_strdup(score,
+               score->error = tal_strdup(score,
        "You have no _info file.\n\n"
        "The file _info contains the metadata for a ccan package: things\n"
        "like the dependencies, the documentation for the package as a whole\n"
@@ -30,8 +31,9 @@ static void check_has_info(struct manifest *m,
 }
 
 static const char template[] =
-       "#include <string.h>\n"
        "#include \"config.h\"\n"
+       "#include <stdio.h>\n"
+       "#include <string.h>\n"
        "\n"
        "/**\n"
        " * %s - YOUR-ONE-LINE-DESCRIPTION-HERE\n"
@@ -55,7 +57,8 @@ static const char template[] =
        "       return 1;\n"
        "}\n";
 
-static void create_info_template(struct manifest *m, struct score *score)
+static void create_info_template(struct manifest *m,
+                                struct score *score UNNEEDED)
 {
        FILE *info;
        const char *filename;
@@ -63,7 +66,7 @@ static void create_info_template(struct manifest *m, struct score *score)
        if (!ask("Should I create a template _info file for you?"))
                return;
 
-       filename = talloc_asprintf(m, "%s/%s", m->dir, "_info");
+       filename = tal_fmt(m, "%s/%s", m->dir, "_info");
        info = fopen(filename, "w");
        if (!info)
                err(1, "Trying to create a template _info in %s", filename);