]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0093: Still a qsort() comparison function that returns result of subtraction v9.1.0093
authorzeertzjq <zeertzjq@outlook.com>
Sat, 10 Feb 2024 12:24:03 +0000 (13:24 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 10 Feb 2024 12:24:03 +0000 (13:24 +0100)
Problem:  Still a qsort() comparison function fuzzy_match_item_compare()
          that returns result of subtraction (after 9.1.0089).
Solution: Use an explicit comparison instead of subtraction.
          (zeertzjq)

closes: #14004

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/search.c
src/version.c

index eadbcd3d9336b13e3fa73fa0f9859381c9b5c7f3..1d0542b658c6c2bdf9bb6e31089759b038d193f4 100644 (file)
@@ -4561,7 +4561,10 @@ fuzzy_match_item_compare(const void *s1, const void *s2)
     int                idx1 = ((fuzzyItem_T *)s1)->idx;
     int                idx2 = ((fuzzyItem_T *)s2)->idx;
 
-    return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1;
+    if (v1 == v2)
+       return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1;
+    else
+       return v1 > v2 ? -1 : 1;
 }
 
 /*
index 86ed8b708d127e5417cb669cabfc91c89e51c5df..685f8b0df3b6e198dcd422abfadcfc66b56c559a 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    93,
 /**/
     92,
 /**/