diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-05-26 13:14:53 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-05-26 13:14:53 +0300 |
commit | 3a32216d0299c6aa771ae849749c3f590db82a0d (patch) | |
tree | 016a1029e1ad99ed04213c08f23bd63f163bf13c /lib/psm.c | |
parent | 77c25969a97cc3fc31e7c8bdbc27a99481ae828a (diff) | |
download | rpm-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.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -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)); } /** |