diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-06-14 18:23:47 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-06-14 18:23:47 +0000 |
commit | d0f685de3ac9ca8fd93311f06695f0c03b7299d7 (patch) | |
tree | 5d2bf970590ea4c3576d132fe6773a4ed7c3d669 | |
parent | a7c1739c95b0b2f9ef189b0fd80b296a377eea04 (diff) | |
download | perl-URPM-d0f685de3ac9ca8fd93311f06695f0c03b7299d7.tar perl-URPM-d0f685de3ac9ca8fd93311f06695f0c03b7299d7.tar.gz perl-URPM-d0f685de3ac9ca8fd93311f06695f0c03b7299d7.tar.bz2 perl-URPM-d0f685de3ac9ca8fd93311f06695f0c03b7299d7.tar.xz perl-URPM-d0f685de3ac9ca8fd93311f06695f0c03b7299d7.zip |
(_header_free) introduce this helper in order to simplify
-rw-r--r-- | URPM.xs | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -113,6 +113,11 @@ static int rpmError_callback() { return RPMLOG_DEFAULT; } +static inline void _header_free(URPM__Package pkg) { + if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) + pkg->h = headerFree(pkg->h); +} + static int rpm_codeset_is_utf8 = 0; static SV* @@ -844,7 +849,7 @@ pack_header(const URPM__Package pkg) { pkg->summary = memcpy(malloc(len), summary, len); } - if (!(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h =headerFree(pkg->h); + _header_free(pkg); pkg->h = NULL; } } @@ -1217,7 +1222,7 @@ update_header(char *filename, URPM__Package pkg, __attribute__((unused)) int kee if (fd != NULL && rpmReadPackageFile(ts, fd, filename, &header) == 0 && header) { Fclose(fd); - if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h = headerFree(pkg->h); + _header_free(pkg); pkg->h = header; pkg->flag &= ~FLAG_NO_HEADER_FREE; @@ -1232,7 +1237,7 @@ update_header(char *filename, URPM__Package pkg, __attribute__((unused)) int kee close(d); if (fd != NULL) { - if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h = headerFree(pkg->h); + _header_free(pkg); pkg->h = headerRead(fd, HEADER_MAGIC_YES); pkg->flag &= ~FLAG_NO_HEADER_FREE; Fclose(fd); @@ -1413,7 +1418,7 @@ Pkg_DESTROY(pkg) free(pkg->provides); free(pkg->rflags); free(pkg->summary); - if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h = headerFree(pkg->h); + _header_free(pkg); free(pkg); void @@ -2202,7 +2207,7 @@ void Pkg_free_header(pkg) URPM::Package pkg CODE: - if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h = headerFree(pkg->h); + _header_free(pkg); pkg->h = NULL; void |