X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fmodule_builds.c;h=45b67c5a5424373c4954aa1a106dc898a44da03e;hb=6aa2f4e347e5d66a392b879fe901bc582099a552;hp=52059af795846fafed7c09f11ddfe5d530b03ff4;hpb=60824f8a0f758dc7808eb31cc83434ea78f44ed1;p=ccan diff --git a/tools/ccanlint/tests/module_builds.c b/tools/ccanlint/tests/module_builds.c index 52059af7..45b67c5a 100644 --- a/tools/ccanlint/tests/module_builds.c +++ b/tools/ccanlint/tests/module_builds.c @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include #include #include @@ -24,37 +24,24 @@ static const char *can_build(struct manifest *m) static char *obj_list(const struct manifest *m, enum compile_type ctype) { - char *list = talloc_strdup(m, ""); + char *list = tal_strdup(m, ""); struct ccan_file *i; /* Objects from all the C files. */ - list_for_each(&m->c_files, i, list) - list = talloc_asprintf_append(list, "%s ", - i->compiled[ctype]); - + list_for_each(&m->c_files, i, list) { + list = tal_strcat(m, take(list), i->compiled[ctype]); + list = tal_strcat(m, take(list), " "); + } return list; } -char *build_module(struct manifest *m, bool keep, +char *build_module(struct manifest *m, enum compile_type ctype, char **errstr) { - char *name = link_objects(m, m->basename, false, obj_list(m, ctype), - errstr); - if (name) { - if (keep) { - char *realname = talloc_asprintf(m, "%s.o", m->dir); - assert(ctype == COMPILE_NORMAL); - /* We leave this object file around, all built. */ - if (!move_file(name, realname)) - err(1, "Renaming %s to %s", name, realname); - name = realname; - } - } - return name; + return link_objects(m, m->basename, obj_list(m, ctype), errstr); } static void do_build(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { @@ -68,7 +55,7 @@ static void do_build(struct manifest *m, } m->compiled[COMPILE_NORMAL] - = build_module(m, keep, COMPILE_NORMAL, &errstr); + = build_module(m, COMPILE_NORMAL, &errstr); if (!m->compiled[COMPILE_NORMAL]) { score_file_error(score, NULL, 0, "%s", errstr); return;