Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
qsort(): ptrdiff_t may be larger than int
author
Junio C Hamano
<junkio@cox.net>
Fri, 9 Dec 2005 01:29:11 +0000
(17:29 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Fri, 9 Dec 2005 01:29:11 +0000
(17:29 -0800)
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>
server-info.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
c82365d
)
diff --git
a/server-info.c
b/server-info.c
index 7d7bcb2188e8f4a65f83a4693220864d0a255951..df19e49b5be75f2cc75e24ba6cda0c94631b434d 100644
(file)
--- a/
server-info.c
+++ b/
server-info.c
@@
-140,7
+140,12
@@
static int compare_info(const void *a_, const void *b_)
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)