aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--URPM.xs31
2 files changed, 14 insertions, 19 deletions
diff --git a/NEWS b/NEWS
index e51e860..591a4d9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- internal cleanups
+
Version 4.3 - 14 June 2012
- fix a very old segfault in unused code
diff --git a/URPM.xs b/URPM.xs
index 907620d..a1d29d4 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -837,12 +837,10 @@ pack_header(const URPM__Package pkg) {
if (pkg->info == NULL) {
char buff[1024];
const char *p = buff;
- const char *name = get_name(pkg->h, RPMTAG_NAME);
- const char *version = get_name(pkg->h, RPMTAG_VERSION);
- const char *release = get_name(pkg->h, RPMTAG_RELEASE);
+ const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR);
const char *arch = get_arch(pkg->h);
- p += 1 + snprintf(buff, sizeof(buff), "%s-%s-%s.%s@%d@%d@%s", name, version, release, arch,
+ p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%d@%d@%s", nvr, arch,
get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE),
get_name(pkg->h, RPMTAG_GROUP));
pkg->info = memcpy(malloc(p-buff), buff, p-buff);
@@ -1615,18 +1613,17 @@ Pkg_fullname(pkg)
mPUSHs(newSVpv(arch, eos-arch));
}
} else if (pkg->h) {
- char *name = get_name(pkg->h, RPMTAG_NAME);
- char *version = get_name(pkg->h, RPMTAG_VERSION);
- char *release = get_name(pkg->h, RPMTAG_RELEASE);
char *arch = get_arch(pkg->h);
if (gimme == G_SCALAR) {
- mXPUSHs(newSVpvf("%s-%s-%s.%s", name, version, release, arch));
+ const char *s = headerGetAsString(pkg->h, RPMTAG_NVR);
+ mXPUSHs(newSVpvf("%s.%s", s, arch));
+ free(s);
} else if (gimme == G_ARRAY) {
EXTEND(SP, 4);
- mPUSHs(newSVpv(name, 0));
- mPUSHs(newSVpv(version, 0));
- mPUSHs(newSVpv(release, 0));
+ mPUSHs(newSVpv(get_name(pkg->h, RPMTAG_NAME), 0));
+ mPUSHs(newSVpv(get_name(pkg->h, RPMTAG_VERSION), 0));
+ mPUSHs(newSVpv(get_name(pkg->h, RPMTAG_RELEASE), 0));
mPUSHs(newSVpv(arch, 0));
}
}
@@ -1907,12 +1904,10 @@ Pkg_filename(pkg)
memcpy(eon, savbuf, 4);
}
} else if (pkg->h) {
- char *name = get_name(pkg->h, RPMTAG_NAME);
- char *version = get_name(pkg->h, RPMTAG_VERSION);
- char *release = get_name(pkg->h, RPMTAG_RELEASE);
+ char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR);
char *arch = get_arch(pkg->h);
- mXPUSHs(newSVpvf("%s-%s-%s.%s.rpm", name, version, release, arch));
+ mXPUSHs(newSVpvf("%s.%s.rpm", nvr, arch));
}
# deprecated
@@ -1929,12 +1924,10 @@ Pkg_header_filename(pkg)
} else if (pkg->h) {
char buff[1024];
char *p = buff;
- char *name = get_name(pkg->h, RPMTAG_NAME);
- char *version = get_name(pkg->h, RPMTAG_VERSION);
- char *release = get_name(pkg->h, RPMTAG_RELEASE);
+ char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR);
char *arch = get_arch(pkg->h);
- p += snprintf(buff, sizeof(buff), "%s-%s-%s.%s", name, version, release, arch);
+ p += snprintf(buff, sizeof(buff), "%s.%s", nvr, arch);
mXPUSHs(newSVpv(buff, p-buff));
}