From 5e6b00d7bdf7d489de7b38b210a70de36b80cb4a Mon Sep 17 00:00:00 2001 From: "Luiz Fernando N. Capitulino" Date: Wed, 29 Aug 2007 15:21:04 -0300 Subject: [PATCH] packv4: Kill duplicated code in pack-objects Signed-off-by: Luiz Fernando N. Capitulino --- builtin-pack-objects.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 475f0b56ae..4fe81a723b 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -175,26 +175,15 @@ static void prepare_pack_revindex(struct pack_revindex *rix) rix->revindex = xmalloc(sizeof(*rix->revindex) * (num_ent + 1)); index += 4 * 256; - if (p->index_version > 2) { - const uint32_t *off_32 = - (uint32_t *)(index + 8 + p->num_objects * 4); - const uint32_t *off_64 = off_32 + p->num_objects; - for (i = 0; i < num_ent; i++) { - uint32_t off = ntohl(*off_32++); - if (!(off & 0x80000000)) { - rix->revindex[i].offset = off; - } else { - rix->revindex[i].offset = - ((uint64_t)ntohl(*off_64++)) << 32; - rix->revindex[i].offset |= - ntohl(*off_64++); - } - rix->revindex[i].nr = i; - } - } else if (p->index_version > 1) { - const uint32_t *off_32 = + if (p->index_version > 1) { + uint32_t *off_32, *off_64; + if (p->index_version > 2) { + off_32 = (uint32_t *)(index + 8 + p->num_objects * 4); + } else { + off_32 = (uint32_t *)(index + 8 + p->num_objects * (20 + 4)); - const uint32_t *off_64 = off_32 + p->num_objects; + } + off_64 = off_32 + p->num_objects; for (i = 0; i < num_ent; i++) { uint32_t off = ntohl(*off_32++); if (!(off & 0x80000000)) { -- 2.11.4.GIT