* Note that except for '~' prefixed segments, a string has more segments is newer.
* So, this check must be after the '~' check. */
if (*a == '\0' || *b == '\0')
- return strcmp(a, b);
+ return CMP(*a, *b);
/* Handle '-', which separates version and release, e.g 123.4-3.1.fc33.x86_64 */
if (*a == '-' || *b == '-') {
/* Find the leading numeric segments. One may be an empty string. So,
* numeric segments are always newer than alpha segments. */
- for (aa = a; *aa != '\0' && isdigit(*aa); aa++)
+ for (aa = a; isdigit(*aa); aa++)
;
- for (bb = b; *bb != '\0' && isdigit(*bb); bb++)
+ for (bb = b; isdigit(*bb); bb++)
;
/* To compare numeric segments without parsing their values, first compare the
return r;
} else {
/* Find the leading non-numeric segments. */
- for (aa = a; *aa != '\0' && is_alpha(*aa); aa++)
+ for (aa = a; is_alpha(*aa); aa++)
;
- for (bb = b; *bb != '\0' && is_alpha(*bb); bb++)
+ for (bb = b; is_alpha(*bb); bb++)
;
/* Note that the segments are usually not NUL-terminated. */