diff options
author | Guillem Jover <guillem@debian.org> | 2015-10-18 15:34:45 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-12-12 21:49:37 +0100 |
commit | 0db77512a15877ca25384b775406323a2302c125 (patch) | |
tree | 68167f8660ac41510c90a497664ab0eb16ef6702 /dpkg-deb/build.c | |
parent | 302829039a4dba8a37fa31dfc0e06ca4a8e5a04b (diff) | |
download | dpkg-0db77512a15877ca25384b775406323a2302c125.tar.gz |
Use new str_fmt() instead of m_asprintf()
It should make the code more clear, and in many cases it avoids having
to use a temporary variable.
Diffstat (limited to 'dpkg-deb/build.c')
-rw-r--r-- | dpkg-deb/build.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index b364f9abb..2ddeec620 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -344,7 +344,7 @@ check_control_file(const char *ctrldir) struct pkginfo *pkg; char *controlfile; - m_asprintf(&controlfile, "%s/%s", ctrldir, CONTROLFILE); + controlfile = str_fmt("%s/%s", ctrldir, CONTROLFILE); parsedb(controlfile, pdb_parse_binary, &pkg); if (strspn(pkg->set->name, "abcdefghijklmnopqrstuvwxyz0123456789+-.") != @@ -431,7 +431,6 @@ static char * gen_dest_pathname_from_pkg(const char *dir, struct pkginfo *pkg) { const char *arch_sep; - char *path; if (pkg->available.arch->type == DPKG_ARCH_NONE || pkg->available.arch->type == DPKG_ARCH_EMPTY) @@ -439,11 +438,9 @@ gen_dest_pathname_from_pkg(const char *dir, struct pkginfo *pkg) else arch_sep = "_"; - m_asprintf(&path, "%s/%s_%s%s%s%s", dir, pkg->set->name, - versiondescribe(&pkg->available.version, vdew_never), - arch_sep, pkg->available.arch->name, DEBEXT); - - return path; + return str_fmt("%s/%s_%s%s%s%s", dir, pkg->set->name, + versiondescribe(&pkg->available.version, vdew_never), + arch_sep, pkg->available.arch->name, DEBEXT); } typedef void filenames_feed_func(const char *dir, int fd_out); @@ -525,7 +522,7 @@ do_build(const char *const *argv) badusage(_("--%s takes at most two arguments"), cipaction->olong); debar = gen_dest_pathname(dir, dest); - m_asprintf(&ctrldir, "%s/%s", dir, BUILDCONTROLDIR); + ctrldir = str_fmt("%s/%s", dir, BUILDCONTROLDIR); /* Perform some sanity checks on the to-be-build package. */ if (nocheckflag) { |