summaryrefslogtreecommitdiff
path: root/src/strverscmp.c
diff options
context:
space:
mode:
authorTim van der Molen <tim@kariliq.nl>2023-03-28 22:01:44 +0200
committerderf <derf@chaosdorf.de>2023-04-06 14:39:52 +0200
commit2b29446d1f22ef3557cfdf63c3df701b6834ff36 (patch)
tree5c57c55bf9dc61b52dd9028c3820878221cd984d /src/strverscmp.c
parent9214cb0350c4aa81b209a8f90ec2d08a6ff6e705 (diff)
Sync strverscmp.c with upstream musl
Diffstat (limited to 'src/strverscmp.c')
-rw-r--r--src/strverscmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/strverscmp.c b/src/strverscmp.c
index 92cd877..ddc6b6d 100644
--- a/src/strverscmp.c
+++ b/src/strverscmp.c
@@ -41,9 +41,9 @@ int strverscmp(const char *l0, const char *r0)
else if (c!='0') z=0;
}
- if (l[dp]!='0' && r[dp]!='0') {
- /* If we're not looking at a digit sequence that began
- * with a zero, longest digit string is greater. */
+ if (l[dp]-'1'<9U && r[dp]-'1'<9U) {
+ /* If we're looking at non-degenerate digit sequences starting
+ * with nonzero digits, longest digit string is greater. */
for (j=i; isdigit(l[j]); j++)
if (!isdigit(r[j])) return 1;
if (isdigit(r[j])) return -1;