Cleanup: correct logic for qsort callback

Adding the additional check is more of a "technical" correction,
for the callback to return 0 the sort implementation would have
to compare an element in the array with itself.

Co-authored-by: Zheng-Ze <zheng-ze@noreply.localhost>

Ref !137723
This commit is contained in:
Campbell Barton
2025-04-23 20:42:27 +10:00
parent 587ddace88
commit 570e9d2bb3

View File

@@ -1849,10 +1849,15 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2)
if (dw1->weight > dw2->weight) {
return -1;
}
/* Compare address for stable sort algorithm. */
if (&dw1 < &dw2) {
return 1; /* compare address for stable sort algorithm */
return 1;
}
return -1;
if (&dw1 > &dw2) {
return -1;
}
return 0;
}
/* Used for limiting the number of influencing bones per vertex when exporting