]> pd.if.org Git - zpackage/commitdiff
remove release special handling from vercmp
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 29 Sep 2018 22:47:26 +0000 (22:47 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 29 Sep 2018 22:47:26 +0000 (22:47 +0000)
lib/vercmp.c

index 16cf1cdc4eab48ab1f4b89b4cac0178d23b4a858..e6a415ca4b883bd7196a518fd7f045a3d8e00597 100644 (file)
@@ -13,8 +13,6 @@ struct ver {
        
        int nv; /* numeric value */
        int type; /* 0 null, 1 text, 2 numeric */
-       int release;
-       char *relstr;
 };
 
 static void init_ver(struct ver *v, const char *s) {
@@ -23,24 +21,8 @@ static void init_ver(struct ver *v, const char *s) {
        v->s = 0;
        v->cn = 0;
        v->next = v->str;
-       v->relstr = 0;
        v->keep = 0;
        v->sep = 0;
-
-       /* scan for trailing release */
-       int n;
-       n = strlen(v->str) - 1;
-       if (n > 0 && isdigit(v->str[n])) {
-               while (isdigit(v->str[n])) {
-                       n--;
-               }
-               if (s[n] == '-') {
-                       v->relstr = v->str + n;
-                       v->release = atoi(v->str + n + 1);
-                       v->str[n] = 0;
-               }
-       }
-
 }
 
 static int ver_cmp(struct ver *a, struct ver *b) {
@@ -54,7 +36,9 @@ static int ver_cmp(struct ver *a, struct ver *b) {
                int cmp;
                if (a->s && ! b->s) return 1;
                if (b->s && ! a->s) return -1;
-               if (!b->s && ! a->s) return 0;
+               if (!b->s && ! a->s) {
+                       return 0;
+               }
                cmp = strcmp(a->s, b->s);
                if (cmp == 0) {
                        return 0;
@@ -139,10 +123,5 @@ int zpm_vercmp(const char *vsa, const char *vsb) {
                }
        } while (an && bn);
 
-       /* if we've gotten here, and both have releases, check those */
-       if (a.relstr && b.relstr && a.release != b.release) {
-               return a.release < b.release ? -1 : 1;
-       }
-       
        return 0;
 }