X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fconfigurator%2Fconfigurator.c;h=119404f54f855e184e891b9dad0ff99da8961e61;hp=f4edb8ee1b214dbf97106bffe91335b12d5737ac;hb=eda7c5a20ecb045b5a0181261537bdbef6125a6d;hpb=7011546929cfc537028eb4fd091104b383b5c86f diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index f4edb8ee..119404f5 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -282,7 +282,8 @@ static struct test tests[] = { "int main(int argc, char *argv[]) {\n" " char pad[sizeof(int *) * 1];\n" " strncpy(pad, argv[0], sizeof(pad));\n" - " return *(int *)(pad) == *(int *)(pad + 1);\n" + " int *x = (int *)pad, *y = (int *)(pad + 1);\n" + " return *x == *y;\n" "}\n" }, { "HAVE_UTIME", DEFINES_FUNC, NULL, NULL, "#include \n" @@ -430,6 +431,9 @@ static bool run_test(const char *cmd, struct test *test) test->done = true; return test->answer; } + if (deps[len]) + free(dep); + deps += len; deps += strspn(deps, " "); } @@ -549,6 +553,7 @@ int main(int argc, const char *argv[]) cmd = connect_args(argv, " -o " OUTPUT_FILE " " INPUT_FILE); for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) run_test(cmd, &tests[i]); + free(cmd); unlink(OUTPUT_FILE); unlink(INPUT_FILE); @@ -560,7 +565,9 @@ int main(int argc, const char *argv[]) printf("#define _GNU_SOURCE /* Always use GNU extensions. */\n"); printf("#endif\n"); printf("#define CCAN_COMPILER \"%s\"\n", argv[1]); - printf("#define CCAN_CFLAGS \"%s\"\n\n", connect_args(argv+1, "")); + cmd = connect_args(argv+1, ""); + printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd); + free(cmd); /* This one implies "#include