aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-12-02 14:52:14 +0000
committerThierry Vignaud <tv@mageia.org>2012-12-02 14:52:14 +0000
commit3907975da95d9fc650b3d779391420bcee6ec0e6 (patch)
treeaa630ee251f68a149f84359d40a03a3f4b0cf400
parent452a3869137c6f7a2257c1c0075cbf5c5dbf9880 (diff)
downloadperl-URPM-3907975da95d9fc650b3d779391420bcee6ec0e6.tar
perl-URPM-3907975da95d9fc650b3d779391420bcee6ec0e6.tar.gz
perl-URPM-3907975da95d9fc650b3d779391420bcee6ec0e6.tar.bz2
perl-URPM-3907975da95d9fc650b3d779391420bcee6ec0e6.tar.xz
perl-URPM-3907975da95d9fc650b3d779391420bcee6ec0e6.zip
(Pkg_description, Pkg_sourcerpm) split UTF-8 strings from raw strings
functions, then simplify
-rw-r--r--URPM.xs54
1 files changed, 31 insertions, 23 deletions
diff --git a/URPM.xs b/URPM.xs
index 2c4d1a2..b5579ae 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1507,39 +1507,47 @@ void
Pkg_description(pkg)
URPM::Package pkg
ALIAS:
- sourcerpm = 1
- packager = 2
- buildhost = 3
- url = 4
- license = 5
- distribution = 6
- vendor = 7
- os = 8
- payload_format = 9
+ packager = 1
PPCODE:
- if (pkg->h)
+ if (pkg->h) {
+ rpmTag tag = ix == 0 ? RPMTAG_DESCRIPTION : RPMTAG_PACKAGER;
+ mXPUSHs(newSVpv_utf8(get_name(pkg->h, tag), 0));
+ }
+
+void
+Pkg_sourcerpm(pkg)
+ URPM::Package pkg
+ ALIAS:
+ buildhost = 1
+ url = 2
+ license = 3
+ distribution = 4
+ vendor = 5
+ os = 6
+ payload_format = 8
+ PPCODE:
+ if (pkg->h) {
+ rpmTag tag;
switch (ix) {
- case 0:
- mXPUSHs(newSVpv_utf8(get_name(pkg->h, RPMTAG_DESCRIPTION), 0)); break;
case 1:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_SOURCERPM), 0)); break;
+ tag = RPMTAG_BUILDHOST; break;
case 2:
- mXPUSHs(newSVpv_utf8(get_name(pkg->h, RPMTAG_PACKAGER), 0)); break;
+ tag = RPMTAG_URL; break;
case 3:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_BUILDHOST), 0)); break;
+ tag = RPMTAG_LICENSE; break;
case 4:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_URL), 0)); break;
+ tag = RPMTAG_DISTRIBUTION; break;
case 5:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_LICENSE), 0)); break;
+ tag = RPMTAG_VENDOR; break;
case 6:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_DISTRIBUTION), 0)); break;
+ tag = RPMTAG_OS; break;
case 7:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_VENDOR), 0)); break;
- case 8:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_OS), 0)); break;
- case 9:
- mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_PAYLOADFORMAT), 0)); break;
+ tag = RPMTAG_PAYLOADFORMAT; break;
+ default:
+ tag = RPMTAG_SOURCERPM; break;
}
+ mXPUSHs(newSVpv(get_name(pkg->h, tag), 0));
+ }
int
Pkg_buildtime(pkg)