diff options
author | Thierry Vignaud <tv@mageia.org> | 2013-01-20 21:08:00 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2013-01-20 21:08:00 +0000 |
commit | 0eacdf9a90f9288c7670d263d523098044f6abbc (patch) | |
tree | 8ba1d78f7e6e073d7fafb13fc189c7b07db6b06f | |
parent | fe3638feae4fd707f95e560af8ebdd5c56dc0872 (diff) | |
download | perl-URPM-0eacdf9a90f9288c7670d263d523098044f6abbc.tar perl-URPM-0eacdf9a90f9288c7670d263d523098044f6abbc.tar.gz perl-URPM-0eacdf9a90f9288c7670d263d523098044f6abbc.tar.bz2 perl-URPM-0eacdf9a90f9288c7670d263d523098044f6abbc.tar.xz perl-URPM-0eacdf9a90f9288c7670d263d523098044f6abbc.zip |
(stream2header,spec2srcheader) simplify
-rw-r--r-- | URPM.xs | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -3213,12 +3213,8 @@ Urpm_stream2header(fp) if ((fd = fdDup(fileno(fp)))) { pkg = (URPM__Package)calloc(1, sizeof(struct s_Package)); pkg->h = headerRead(fd, HEADER_MAGIC_YES); - if (pkg->h) { - SV *sv_pkg; - sv_pkg = sv_newmortal(); - sv_setref_pv(sv_pkg, "URPM::Package", (void*)pkg); - XPUSHs(sv_pkg); - } + if (pkg->h) + XPUSHs(sv_setref_pv(sv_newmortal(), "URPM::Package", (void*)pkg)); Fclose(fd); } @@ -3237,12 +3233,9 @@ Urpm_spec2srcheader(specfile) spec = rpmSpecParse(specfile, RPMSPEC_ANYARCH|RPMSPEC_FORCE, NULL); if (spec) { header = rpmSpecSourceHeader(spec); - SV *sv_pkg; pkg = (URPM__Package)calloc(1, sizeof(struct s_Package)); pkg->h = headerLink(header); - sv_pkg = sv_newmortal(); - sv_setref_pv(sv_pkg, "URPM::Package", (void*)pkg); - XPUSHs(sv_pkg); + XPUSHs(sv_setref_pv(sv_newmortal(), "URPM::Package", (void*)pkg)); spec = rpmSpecFree(spec); } else { XPUSHs(&PL_sv_undef); |