X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fmodule_links.c;h=c3c638d7be1c3ba9cc9d3e1fddeedb0cf8185180;hp=5c25e6126589ebd0cadd01d15b4fd66e8a18e11c;hb=dc8042b42500f79f613b1197df6cdf739615a89f;hpb=aabf300e324f7da5134d7ad45afba11225045c24 diff --git a/tools/ccanlint/tests/module_links.c b/tools/ccanlint/tests/module_links.c index 5c25e612..c3c638d7 100644 --- a/tools/ccanlint/tests/module_links.c +++ b/tools/ccanlint/tests/module_links.c @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include #include #include @@ -27,16 +27,16 @@ static char *obj_list(const struct manifest *m) struct manifest *i; if (m->compiled[COMPILE_NORMAL]) - list = talloc_strdup(m, m->compiled[COMPILE_NORMAL]); + list = tal_strdup(m, m->compiled[COMPILE_NORMAL]); else - list = talloc_strdup(m, ""); + list = tal_strdup(m, ""); /* Other CCAN deps. */ list_for_each(&m->deps, i, list) { - if (i->compiled[COMPILE_NORMAL]) - list = talloc_asprintf_append(list, " %s", - i->compiled - [COMPILE_NORMAL]); + if (!i->compiled[COMPILE_NORMAL]) + continue; + list = tal_strcat(m, take(list), " "); + list = tal_strcat(m, take(list), i->compiled[COMPILE_NORMAL]); } return list; } @@ -45,11 +45,11 @@ static char *lib_list(const struct manifest *m) { unsigned int i; char **libs; - char *ret = talloc_strdup(m, ""); + char *ret = tal_strdup(m, ""); libs = get_libs(m, m->dir, "depends", get_or_compile_info); for (i = 0; libs[i]; i++) - ret = talloc_asprintf_append(ret, "-l%s ", libs[i]); + tal_append_fmt(&ret, "-l%s ", libs[i]); return ret; } @@ -66,13 +66,13 @@ static void check_use_build(struct manifest *m, if (fd < 0) err(1, "Creating temporary file %s", tmpfile); - contents = talloc_asprintf(tmpfile, - "#include \n" - "int main(void)\n" - "{\n" - " return 0;\n" - "}\n", - m->modname, m->basename); + contents = tal_fmt(tmpfile, + "#include \n" + "int main(void)\n" + "{\n" + " return 0;\n" + "}\n", + m->modname, m->basename); if (write(fd, contents, strlen(contents)) != strlen(contents)) err(1, "Failure writing to temporary file %s", tmpfile); close(fd);