X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fcompile_test_helpers.c;h=de8d4632c9fbea9aa9ff992a2b0a0eb78a879d91;hp=2aa8d8639800a379bad6d42f70652b09b5393cda;hb=687cde2a8c561b68f17609b615eb930ea02f5aac;hpb=3612661714e86333ceacca7314959a5ed938dc6a diff --git a/tools/ccanlint/tests/compile_test_helpers.c b/tools/ccanlint/tests/compile_test_helpers.c index 2aa8d863..de8d4632 100644 --- a/tools/ccanlint/tests/compile_test_helpers.c +++ b/tools/ccanlint/tests/compile_test_helpers.c @@ -21,17 +21,14 @@ static const char *can_build(struct manifest *m) return NULL; } -static char *objname(const void *ctx, const char *cfile) +static char *compile(struct manifest *m, struct ccan_file *cfile) { - return talloc_asprintf(ctx, "%.*s.o ", strlen(cfile) - 2, cfile); -} - -static char *compile(struct manifest *m, const char *cfile) -{ - char *obj; + char *err; - obj = objname(m, cfile); - return compile_object(m, obj, cfile); + cfile->compiled = compile_object(m, cfile->name, &err); + if (cfile->compiled) + return NULL; + return err; } static void *do_compile_test_helpers(struct manifest *m) @@ -41,7 +38,7 @@ static void *do_compile_test_helpers(struct manifest *m) list_for_each(&m->other_test_c_files, i, list) { compile_tests.total_score++; - cmdout = compile(m, i->name); + cmdout = compile(m, i); if (cmdout) return talloc_asprintf(m, "Failed to compile helper C"