summaryrefslogtreecommitdiff
path: root/server-info.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-09 01:29:11 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-12-09 01:29:11 (GMT)
commit2dee581667d62d113605e97de0beda6a9dbca153 (patch)
tree1545a70c9de4a0ef168fdbd5a37316d1f3786fc8 /server-info.c
parentc82365dc6f211722cbbed96f41a61f477914c91a (diff)
downloadgit-2dee581667d62d113605e97de0beda6a9dbca153.zip
git-2dee581667d62d113605e97de0beda6a9dbca153.tar.gz
git-2dee581667d62d113605e97de0beda6a9dbca153.tar.bz2
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>
Diffstat (limited to 'server-info.c')
-rw-r--r--server-info.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/server-info.c b/server-info.c
index 7d7bcb2..df19e49 100644
--- 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)