if (sort_nr)
{
if (l1.st_u.num.is_number != l2.st_u.num.is_number)
- result = l1.st_u.num.is_number - l2.st_u.num.is_number;
+ result = l1.st_u.num.is_number > l2.st_u.num.is_number ? 1 : -1;
else
result = l1.st_u.num.value == l2.st_u.num.value ? 0
: l1.st_u.num.value > l2.st_u.num.value ? 1 : -1;
listitem_T *li1 = *(listitem_T **)a1;
listitem_T *li2 = *(listitem_T **)a2;
- return li1->li_tv.vval.v_number - li2->li_tv.vval.v_number;
+ return li1->li_tv.vval.v_number == li2->li_tv.vval.v_number ? 0 :
+ li1->li_tv.vval.v_number > li2->li_tv.vval.v_number ? 1 : -1;
}
void
profile_cmp(const proftime_T *tm1, const proftime_T *tm2)
{
# ifdef MSWIN
- return (int)(tm2->QuadPart - tm1->QuadPart);
+ return tm2->QuadPart == tm1->QuadPart ? 0 :
+ tm2->QuadPart > tm1->QuadPart ? 1 : -1;
# else
if (tm1->tv_sec == tm2->tv_sec)
- return tm2->tv_fsec - tm1->tv_fsec;
- return tm2->tv_sec - tm1->tv_sec;
+ return tm2->tv_fsec == tm1->tv_fsec ? 0 :
+ tm2->tv_fsec > tm1->tv_fsec ? 1 : -1;
+ return tm2->tv_sec > tm1->tv_sec ? 1 : -1;
# endif
}
int idx1 = ((fuzmatch_str_T *)s1)->idx;
int idx2 = ((fuzmatch_str_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;
}
/*
char_u *str1 = ((fuzmatch_str_T *)s1)->str;
char_u *str2 = ((fuzmatch_str_T *)s2)->str;
- if (*str1 != '<' && *str2 == '<') return -1;
- if (*str1 == '<' && *str2 != '<') return 1;
- return v1 == v2 ? (idx1 - idx2) : v1 > v2 ? -1 : 1;
+ if (*str1 != '<' && *str2 == '<')
+ return -1;
+ if (*str1 == '<' && *str2 != '<')
+ return 1;
+ if (v1 == v2)
+ return idx1 == idx2 ? 0 : idx1 > idx2 ? 1 : -1;
+ else
+ return v1 > v2 ? -1 : 1;
}
/*
{
suggest_T *p1 = (suggest_T *)s1;
suggest_T *p2 = (suggest_T *)s2;
- int n = p1->st_score - p2->st_score;
+ int n;
+
+ n = p1->st_score == p2->st_score ? 0 :
+ p1->st_score > p2->st_score ? 1 : -1;
if (n == 0)
{
- n = p1->st_altscore - p2->st_altscore;
+ n = p1->st_altscore == p2->st_altscore ? 0 :
+ p1->st_altscore > p2->st_altscore ? 1 : -1;
+
if (n == 0)
n = STRICMP(p1->st_word, p2->st_word);
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 89,
/**/
88,
/**/
* Simple int comparison function for use with qsort()
*/
static int
-int_cmp(const void *a, const void *b)
-{
- return *(const int *)a - *(const int *)b;
+int_cmp(const void *pa, const void *pb)
+{
+ const int a = *(const int *)pa;
+ const int b = *(const int *)pb;
+ if (a > b)
+ return 1;
+ if (a < b)
+ return -1;
+ return 0;
}
/*