]> git.ozlabs.org Git - ccan/blobdiff - tools/depends.c
ccanlint: keep separate array of compiled versions.
[ccan] / tools / depends.c
index ca1b6fc88b0f893814cb279f26b8ec4be3e77e9b..efb42004324b5022d4858c2d5f8fe8aad04a0cbf 100644 (file)
@@ -1,5 +1,5 @@
-#include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
+#include <ccan/talloc/talloc.h>
 #include <ccan/grab_file/grab_file.h>
 #include <ccan/str_talloc/str_talloc.h>
 #include <ccan/read_write_all/read_write_all.h>
@@ -13,7 +13,7 @@
 #include <errno.h>
 
 static char ** __attribute__((format(printf, 2, 3)))
-lines_from_cmd(const void *ctx, char *format, ...)
+lines_from_cmd(const void *ctx, const char *format, ...)
 {
        va_list ap;
        char *cmd, *buffer;
@@ -59,11 +59,12 @@ static char *compile_info(const void *ctx, const char *dir)
                return NULL;
 
        ccandir = talloc_dirname(ctx, dir);
-       *strrchr(ccandir, '/') = '\0';
+       if (strrchr(ccandir, '/'))
+               *strrchr(ccandir, '/') = '\0';
 
        compiled = maybe_temp_file(ctx, "", false, "info");
        if (compile_and_link(ctx, info_c_file, ccandir, "",
-                            CCAN_COMPILER, CCAN_CFLAGS, "",
+                            CCAN_COMPILER, CCAN_CFLAGS " -I.", "",
                             compiled, &output))
                return compiled;
        return NULL;
@@ -254,11 +255,11 @@ char **get_deps(const void *ctx, const char *dir,
 }
 
 char **get_safe_ccan_deps(const void *ctx, const char *dir,
-                         bool recurse, char **infofile)
+                         bool recurse)
 {
        if (!recurse) {
                unsigned int num;
-               return get_one_safe_deps(ctx, dir, &num, infofile);
+               return get_one_safe_deps(ctx, dir, &num, NULL);
        }
-       return get_all_deps(ctx, dir, infofile, get_one_safe_deps);
+       return get_all_deps(ctx, dir, NULL, get_one_safe_deps);
 }