X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fobjects_build_with_stringchecks.c;h=083e7923ac8fca2ca34d39dfa960bb2209dc8fd2;hb=1ddb7420f1ac53c060aec62e26702d1d7029fc54;hp=5c57155d1aaa6a45e42af55c80681ac3d3e7ab04;hpb=678cd10db6d6b81d97f3b98ea0a54657141632ad;p=ccan diff --git a/tools/ccanlint/tests/objects_build_with_stringchecks.c b/tools/ccanlint/tests/objects_build_with_stringchecks.c index 5c57155d..083e7923 100644 --- a/tools/ccanlint/tests/objects_build_with_stringchecks.c +++ b/tools/ccanlint/tests/objects_build_with_stringchecks.c @@ -1,8 +1,6 @@ #include #include -#include #include -#include #include #include #include @@ -26,7 +24,7 @@ static const char *uses_stringfuncs(struct manifest *m) char *match; list_for_each(list, i, list) { - if (strreg(m, get_ccan_file_contents(i), + if (tal_strreg(m, get_ccan_file_contents(i), "(isalnum|isalpha|isascii|isblank|iscntrl" "|isdigit|isgraph|islower|isprint|ispunct" "|isspace|isupper|isxdigit" @@ -58,14 +56,13 @@ static int start_file(const char *filename) static void test_compile(struct score *score, struct ccan_file *file, const char *filename, - bool keep, const char *flags, bool *errors, bool *warnings) { char *output, *compiled; - compiled = maybe_temp_file(score, "", keep, filename); + compiled = temp_file(score, "", filename); if (!compile_object(score, filename, ccan_dir, compiler, flags, compiled, &output)) { score_file_error(score, file, 0, @@ -95,7 +92,7 @@ static struct ccan_file *get_main_header(struct manifest *m) } static void build_objects_with_stringchecks(struct manifest *m, - bool keep, unsigned int *timeleft, + unsigned int *timeleft UNNEEDED, struct score *score) { struct ccan_file *i; @@ -104,27 +101,26 @@ static void build_objects_with_stringchecks(struct manifest *m, int tmpfd; /* FIXME:: We need -I so local #includes work outside normal dir. */ - flags = talloc_asprintf(score, "-I%s %s", m->dir, cflags); + flags = tal_fmt(score, "-I%s %s", m->dir, cflags); /* Won't work into macros, but will get inline functions. */ if (list_empty(&m->c_files)) { char *line; i = get_main_header(m); - tmp = maybe_temp_file(score, ".c", keep, i->fullname); + tmp = temp_file(score, ".c", i->fullname); tmpfd = start_file(tmp); - line = talloc_asprintf(score, "#include \n", - m->basename, m->basename); + line = tal_fmt(score, "#include \n", + m->modname, m->basename); write_str(tmpfd, line); close(tmpfd); - test_compile(score, i, tmp, keep, flags, &errors, &warnings); + test_compile(score, i, tmp, flags, &errors, &warnings); } else { list_for_each(&m->c_files, i, list) { - tmp = maybe_temp_file(score, ".c", keep, i->fullname); + tmp = temp_file(score, ".c", i->fullname); tmpfd = start_file(tmp); write_str(tmpfd, get_ccan_file_contents(i)); close(tmpfd); - test_compile(score, i, tmp, keep, flags, - &errors, &warnings); + test_compile(score, i, tmp, flags, &errors, &warnings); } }