summaryrefslogtreecommitdiff
path: root/builtin/index-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-06-16 14:27:08 -0700
committerJunio C Hamano <gitster@pobox.com>2015-06-16 14:27:08 -0700
commitc3b1c1e9b252ab7bf192c086df53288dbf769c80 (patch)
tree4ef43a0120f2677a6d68b014113ba49bd851a2a9 /builtin/index-pack.c
parent486b51bc81e486c654ac35554b284816f4a6ae5c (diff)
parentf0e7f11d054b79de6e1f7bcee6e68c2f17af61bd (diff)
downloadgit-c3b1c1e9b252ab7bf192c086df53288dbf769c80.tar.gz
Merge branch 'nd/slim-index-pack-memory-usage'
An earlier optimization broke index-pack for a large object transfer; this fixes it before the breakage hits any released version. * nd/slim-index-pack-memory-usage: index-pack: fix truncation of off_t in comparison
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 7ea2020d82..2ecfbae239 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -616,7 +616,9 @@ static int compare_ofs_delta_bases(off_t offset1, off_t offset2,
int cmp = type1 - type2;
if (cmp)
return cmp;
- return offset1 - offset2;
+ return offset1 < offset2 ? -1 :
+ offset1 > offset2 ? 1 :
+ 0;
}
static int find_ofs_delta(const off_t offset, enum object_type type)
@@ -1051,7 +1053,9 @@ static int compare_ofs_delta_entry(const void *a, const void *b)
const struct ofs_delta_entry *delta_a = a;
const struct ofs_delta_entry *delta_b = b;
- return delta_a->offset - delta_b->offset;
+ return delta_a->offset < delta_b->offset ? -1 :
+ delta_a->offset > delta_b->offset ? 1 :
+ 0;
}
static int compare_ref_delta_entry(const void *a, const void *b)