aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs34
1 files changed, 16 insertions, 18 deletions
diff --git a/URPM.xs b/URPM.xs
index e8ec8c3..34d325d 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1639,7 +1639,7 @@ Pkg_compare_pkg(lpkg, rpkg)
}
compare = compare_evrs(lepoch, lversion, lrelease, repoch, rversion, rrelease);
// equal? compare arches too
- if (!compare) {
+ if (!compare) {
int lscore, rscore;
char *eolarch = strchr(larch, '@');
char *eorarch = strchr(rarch, '@');
@@ -1662,7 +1662,7 @@ Pkg_compare_pkg(lpkg, rpkg)
}
if (eolarch) *eolarch = '@';
if (eorarch) *eorarch = '@';
- }
+ }
/* restore info string modified */
if (lpkg->info) {
lrelease[-1] = '-';
@@ -1690,24 +1690,22 @@ Pkg_compare(pkg, evr)
if (!get_e_v_r(pkg, &_epoch, &_version, &_release, &_eos))
croak("undefined package");
- char *epoch = NULL, *version, *release;
+ char *epoch = NULL, *version, *release;
- /* extract epoch and version from evr */
+ /* extract epoch and version from evr */
+ version = evr;
+ while (*version && isdigit(*version)) version++;
+ if (*version == ':') {
+ epoch = evr;
+ *version++ = 0;
+ if (!*epoch) epoch = "0";
+ version[-1] = ':'; /* restore in memory modification */
+ } else {
+ /* there is no epoch defined, so assume epoch = 0 */
version = evr;
- while (*version && isdigit(*version)) version++;
- if (*version == ':') {
- epoch = evr;
- *version++ = 0;
- if (!*epoch) epoch = "0";
- version[-1] = ':'; /* restore in memory modification */
- } else {
- /* there is no epoch defined, so assume epoch = 0 */
- version = evr;
- }
- /* continue extracting release if any */
- if ((release = strrchr(version, '-')) != NULL) {
- *release++ = 0;
- }
+ }
+ if ((release = strrchr(version, '-')) != NULL)
+ *release++ = 0;
repoch = epoch && *epoch ? atoi(epoch) : 0;
RETVAL = compare_evrs(_epoch, _version, _release, repoch, version, release);