diff options
author | Thierry Vignaud <tv@mageia.org> | 2013-01-29 17:55:42 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2013-01-29 17:55:42 +0000 |
commit | deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736 (patch) | |
tree | 1541e736141baa38dc5d68fd9b1d1130826d3316 | |
parent | 4f3c5fb048666aeda7294cae8dabafa82f63f222 (diff) | |
download | perl-URPM-deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736.tar perl-URPM-deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736.tar.gz perl-URPM-deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736.tar.bz2 perl-URPM-deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736.tar.xz perl-URPM-deab9f7e2e2c1f07a24fe2b8fe05e377e7d21736.zip |
(return_list_tag) simplify/factorize
-rw-r--r-- | URPM.xs | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -543,31 +543,28 @@ return_list_tag(const URPM__Package pkg, rpmTag tag_name) { } } } else { - char *name; - char *version; - char *release; - char *arch; - char *eos; + char *name, *version, *release, *arch, *eos, *data = NULL; + int len; switch (tag_name) { case RPMTAG_NAME: { get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (version - name < 1) croak("invalid fullname"); - mXPUSHs(newSVpv(name, version-name - 1)); + data = name; + len = version-name; } break; case RPMTAG_VERSION: { get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (release - version < 1) croak("invalid fullname"); - mXPUSHs(newSVpv(version, release-version - 1)); + data = version; + len = release-version; } break; case RPMTAG_RELEASE: { get_fullname_parts(pkg, &name, &version, &release, &arch, &eos); - if (arch - release < 1) croak("invalid fullname"); - mXPUSHs(newSVpv(release, arch-release - 1)); + data = release; + len = arch-release; } break; case RPMTAG_ARCH: @@ -583,6 +580,10 @@ return_list_tag(const URPM__Package pkg, rpmTag tag_name) { croak("unexpected tag %s", tag_name); break; } + if (data) { + if (len < 1) croak("invalid fullname"); + mXPUSHs(newSVpv(data, len - 1)); + } } PUTBACK; } |