diff options
-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; } |