aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-01-20 21:08:00 +0000
committerThierry Vignaud <tv@mageia.org>2013-01-20 21:08:00 +0000
commit0eacdf9a90f9288c7670d263d523098044f6abbc (patch)
tree8ba1d78f7e6e073d7fafb13fc189c7b07db6b06f /URPM.xs
parentfe3638feae4fd707f95e560af8ebdd5c56dc0872 (diff)
downloadperl-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
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs13
1 files changed, 3 insertions, 10 deletions
diff --git a/URPM.xs b/URPM.xs
index 63c2671..3f1166d 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -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);