diff options
author | Nicolas Pitre <nico@cam.org> | 2007-04-09 01:06:28 -0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-10 12:48:14 -0700 |
commit | 57059091fad25427bce9b3d47e073ce0518d164b (patch) | |
tree | 9e51d626819d9eedc260a157774dc8fe1f06f5e4 /builtin-pack-objects.c | |
parent | 8ff21b1a3307c7059ea1e00b5117a50a2bc5fec8 (diff) | |
download | git-57059091fad25427bce9b3d47e073ce0518d164b.tar.gz |
get rid of num_packed_objects()
The coming index format change doesn't allow for the number of objects
to be determined from the size of the index file directly. Instead, Let's
initialize a field in the packed_git structure with the object count when
the index is validated since the count is always known at that point.
While at it let's reorder some struct packed_git fields to avoid padding
due to needed 64-bit alignment for some of them.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r-- | builtin-pack-objects.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 45ac3e482a..6bff17b130 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -164,7 +164,7 @@ static int cmp_offset(const void *a_, const void *b_) static void prepare_pack_revindex(struct pack_revindex *rix) { struct packed_git *p = rix->p; - int num_ent = num_packed_objects(p); + int num_ent = p->num_objects; int i; const char *index = p->index_data; @@ -198,7 +198,7 @@ static struct revindex_entry * find_packed_object(struct packed_git *p, prepare_pack_revindex(rix); revindex = rix->revindex; lo = 0; - hi = num_packed_objects(p) + 1; + hi = p->num_objects + 1; do { int mi = (lo + hi) / 2; if (revindex[mi].offset == ofs) { |