summaryrefslogtreecommitdiff
path: root/pack-redundant.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-03-07 01:44:30 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-03-07 19:06:25 (GMT)
commitc4001d92be61766d3494489b15590ca0147ee19d (patch)
tree7c78fe4599bf00354ca36299d11b2a1e4e9324bb /pack-redundant.c
parent7cadf491c6d7a29e345e1608c23b0d98cee5e848 (diff)
downloadgit-c4001d92be61766d3494489b15590ca0147ee19d.zip
git-c4001d92be61766d3494489b15590ca0147ee19d.tar.gz
git-c4001d92be61766d3494489b15590ca0147ee19d.tar.bz2
Use off_t when we really mean a file offset.
Not all platforms have declared 'unsigned long' to be a 64 bit value, but we want to support a 64 bit packfile (or close enough anyway) in the near future as some projects are getting large enough that their packed size exceeds 4 GiB. By using off_t, the POSIX type that is declared to mean an offset within a file, we support whatever maximum file size the underlying operating system will handle. For most modern systems this is up around 2^60 or higher. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'pack-redundant.c')
-rw-r--r--pack-redundant.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pack-redundant.c b/pack-redundant.c
index edb5524..c8f7d9a 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -396,9 +396,9 @@ static size_t get_pack_redundancy(struct pack_list *pl)
return ret;
}
-static inline size_t pack_set_bytecount(struct pack_list *pl)
+static inline off_t pack_set_bytecount(struct pack_list *pl)
{
- size_t ret = 0;
+ off_t ret = 0;
while (pl) {
ret += pl->pack->pack_size;
ret += pl->pack->index_size;
@@ -413,7 +413,7 @@ static void minimize(struct pack_list **min)
*non_unique = NULL, *min_perm = NULL;
struct pll *perm, *perm_all, *perm_ok = NULL, *new_perm;
struct llist *missing;
- size_t min_perm_size = (size_t)-1, perm_size;
+ off_t min_perm_size = 0, perm_size;
int n;
pl = local_packs;
@@ -461,7 +461,7 @@ static void minimize(struct pack_list **min)
perm = perm_ok;
while (perm) {
perm_size = pack_set_bytecount(perm->pl);
- if (min_perm_size > perm_size) {
+ if (!min_perm_size || min_perm_size > perm_size) {
min_perm_size = perm_size;
min_perm = perm->pl;
}