From: Michael Schroeder Date: Mon, 14 Jan 2008 10:08:11 +0000 (+0000) Subject: - add evrcmp_str for ma X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53e8cd78a84164b1c19e385f422efb6eb3fb9d5d;p=thirdparty%2Flibsolv.git - add evrcmp_str for ma --- diff --git a/src/evr.c b/src/evr.c index 185cb7c6..28d16cad 100644 --- a/src/evr.c +++ b/src/evr.c @@ -73,23 +73,16 @@ vercmp(const char *s1, const char *q1, const char *s2, const char *q2) return s1 < q1 ? 1 : s2 < q2 ? -1 : 0; } -#define EVRCMP_COMPARE 0 -#define EVRCMP_MATCH_RELEASE 1 -#define EVRCMP_MATCH 2 - -// edition (e:v-r) compare +/* edition (e:v-r) compare */ int -evrcmp(Pool *pool, Id evr1id, Id evr2id, int mode) +evrcmp_str(Pool *pool, const char *evr1, const char *evr2, int mode) { int r; - const char *evr1, *evr2; const char *s1, *s2; const char *r1, *r2; - if (evr1id == evr2id) + if (evr1 == evr2) return 0; - evr1 = id2str(pool, evr1id); - evr2 = id2str(pool, evr2id); #if 0 POOL_DEBUG(DEBUG_EVRCMP, "evrcmp %s %s mode=%d\n", evr1, evr2, mode); @@ -167,6 +160,17 @@ evrcmp(Pool *pool, Id evr1id, Id evr2id, int mode) return r; } +int +evrcmp(Pool *pool, Id evr1id, Id evr2id, int mode) +{ + const char *evr1, *evr2; + if (evr1id == evr2id) + return 0; + evr1 = id2str(pool, evr1id); + evr2 = id2str(pool, evr2id); + return evrcmp_str(pool, evr1, evr2, mode); +} + int evrmatch(Pool *pool, Id evrid, const char *epoch, const char *version, const char *release) { diff --git a/src/evr.h b/src/evr.h index bf80358d..62f68966 100644 --- a/src/evr.h +++ b/src/evr.h @@ -24,6 +24,7 @@ extern "C" { #define EVRCMP_MATCH 2 extern int vercmp(const char *s1, const char *q1, const char *s2, const char *q2); +extern int evrcmp_str(Pool *pool, const char *evr1, const char *evr2, int mode); extern int evrcmp(Pool *pool, Id evr1id, Id evr2id, int mode); extern int evrmatch(Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);