X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fdepends.c;h=c107f4b330c28a2a2473da87aea02cb267a43d6b;hp=041af49e3f214773c463e4ab8823dbb08ea9e1f8;hb=624871f35e94510b9924ba733f2b878ecf2cc6cc;hpb=4c5ed661c625ac2638a18f9540ff5b9f96a6ba6f diff --git a/tools/depends.c b/tools/depends.c index 041af49e..c107f4b3 100644 --- a/tools/depends.c +++ b/tools/depends.c @@ -48,7 +48,7 @@ static char *compile_info(const void *ctx, const char *dir) if (!info) return NULL; - info_c_file = maybe_temp_file(ctx, ".c", false, "_info"); + info_c_file = temp_file(ctx, ".c", "_info"); fd = open(info_c_file, O_WRONLY|O_CREAT|O_EXCL, 0600); if (fd < 0) return NULL; @@ -62,7 +62,7 @@ static char *compile_info(const void *ctx, const char *dir) if (strrchr(ccandir, '/')) *strrchr(ccandir, '/') = '\0'; - compiled = maybe_temp_file(ctx, "", false, "info"); + compiled = temp_file(ctx, "", "info"); if (compile_and_link(ctx, info_c_file, ccandir, "", CCAN_COMPILER, CCAN_CFLAGS " -I.", "", compiled, &output)) @@ -235,7 +235,7 @@ char **get_libs(const void *ctx, const char *dir, } /* FIXME: This is O(n^2), which is dumb. */ -static void uniquify_deps(char **deps) +static char **uniquify_deps(char **deps) { unsigned int i, j, num; @@ -251,7 +251,7 @@ static void uniquify_deps(char **deps) } deps[num] = NULL; /* Make sure talloc_array_length() works */ - deps = talloc_realloc(NULL, deps, char *, num + 1); + return talloc_realloc(NULL, deps, char *, num + 1); } char **get_deps(const void *ctx, const char *dir, @@ -270,8 +270,7 @@ char **get_deps(const void *ctx, const char *dir, unlink(temp); talloc_free(temp); } - uniquify_deps(ret); - return ret; + return uniquify_deps(ret); } char **get_safe_ccan_deps(const void *ctx, const char *dir, @@ -283,6 +282,5 @@ char **get_safe_ccan_deps(const void *ctx, const char *dir, } else { ret = get_all_deps(ctx, dir, NULL, get_one_safe_deps); } - uniquify_deps(ret); - return ret; + return uniquify_deps(ret); }