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) {
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) {
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;
}
} 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;
}