summaryrefslogtreecommitdiff
path: root/lib/psm.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-26 13:14:53 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-26 13:14:53 +0300
commit3a32216d0299c6aa771ae849749c3f590db82a0d (patch)
tree016a1029e1ad99ed04213c08f23bd63f163bf13c /lib/psm.c
parent77c25969a97cc3fc31e7c8bdbc27a99481ae828a (diff)
downloadrpm-3a32216d0299c6aa771ae849749c3f590db82a0d.tar.gz
rpm-3a32216d0299c6aa771ae849749c3f590db82a0d.tar.bz2
rpm-3a32216d0299c6aa771ae849749c3f590db82a0d.zip
Convert rpmVersionComprare() to new headerGet()
Diffstat (limited to 'lib/psm.c')
-rw-r--r--lib/psm.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/psm.c b/lib/psm.c
index be3729385..de6dd102c 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -66,32 +66,32 @@ struct rpmpsm_s {
int rpmVersionCompare(Header first, Header second)
{
- const char * one, * two;
- int32_t * epochOne, * epochTwo;
- static int32_t zero = 0;
+ struct rpmtd_s one, two;
+ static uint32_t zero = 0;
+ uint32_t *epochOne = &zero, *epochTwo = &zero;
int rc;
- if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochOne, NULL))
- epochOne = &zero;
- if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (rpm_data_t *) &epochTwo, NULL))
- epochTwo = &zero;
+ if (headerGet(first, RPMTAG_EPOCH, &one, HEADERGET_MINMEM))
+ epochOne = rpmtdGetUint32(&one);
+ if (headerGet(second, RPMTAG_EPOCH, &two, HEADERGET_MINMEM))
+ epochTwo = rpmtdGetUint32(&two);
- if (*epochOne < *epochTwo)
- return -1;
- else if (*epochOne > *epochTwo)
- return 1;
+ if (*epochOne < *epochTwo)
+ return -1;
+ else if (*epochOne > *epochTwo)
+ return 1;
- rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (rpm_data_t *) &one, NULL);
- rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (rpm_data_t *) &two, NULL);
+ headerGet(first, RPMTAG_VERSION, &one, HEADERGET_MINMEM);
+ headerGet(second, RPMTAG_VERSION, &two, HEADERGET_MINMEM);
- rc = rpmvercmp(one, two);
+ rc = rpmvercmp(rpmtdGetString(&one), rpmtdGetString(&two));
if (rc)
return rc;
- rc = headerGetEntry(first, RPMTAG_RELEASE, NULL, (rpm_data_t *) &one, NULL);
- rc = headerGetEntry(second, RPMTAG_RELEASE, NULL, (rpm_data_t *) &two, NULL);
+ headerGet(first, RPMTAG_RELEASE, &one, HEADERGET_MINMEM);
+ headerGet(second, RPMTAG_RELEASE, &two, HEADERGET_MINMEM);
- return rpmvercmp(one, two);
+ return rpmvercmp(rpmtdGetString(&one), rpmtdGetString(&two));
}
/**