From: Nathan Wagner Date: Sat, 29 Sep 2018 22:47:26 +0000 (+0000) Subject: remove release special handling from vercmp X-Git-Tag: v0.1.7~12 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=8d39ba5617367d688e653ab40192a9c7f9a5c187 remove release special handling from vercmp --- diff --git a/lib/vercmp.c b/lib/vercmp.c index 16cf1cd..e6a415c 100644 --- a/lib/vercmp.c +++ b/lib/vercmp.c @@ -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; }