Commits

Anonymous committed 2dee581

qsort(): ptrdiff_t may be larger than int

This is a companion patch to e23eff8be92a2a2cb66b53deef020063cff285ed
commit. The same logic, the same rationale that a comparison
function that returns an int should not just compute a ptrdiff_t
and return it.

Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits c82365d

Comments (0)

Files changed (1)

File server-info.c

 		return 1;
 
 	/* then it does not matter but at least keep the comparison stable */
-	return (*a)->p - (*b)->p;
+	if ((*a)->p == (*b)->p)
+		return 0;
+	else if ((*a)->p < (*b)->p)
+		return -1;
+	else
+		return 1;
 }
 
 static void init_pack_info(const char *infofile, int force)