- add evrcmp_str for ma
authorMichael Schroeder <mls@suse.de>
Mon, 14 Jan 2008 10:08:11 +0000 (10:08 +0000)
committerMichael Schroeder <mls@suse.de>
Mon, 14 Jan 2008 10:08:11 +0000 (10:08 +0000)
src/evr.c
src/evr.h

index 185cb7c..28d16ca 100644 (file)
--- 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);
@@ -168,6 +161,17 @@ evrcmp(Pool *pool, Id evr1id, Id evr2id, int mode)
 }
 
 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)
 {
   const char *evr1;
index bf80358..62f6896 100644 (file)
--- 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);