aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-08-26 04:12:04 -0400
committerJunio C Hamano <junkio@cox.net>2006-08-26 17:35:20 -0700
commit465b26eeef79e3cb4cb6276e405e59d986069926 (patch)
treef0f0b2e7c81d21f5a5ab826d9e9b0a7711cf55df /sha1_file.c
parent5a18f540a5f8f8ba8b4f8027ed7742bfec85433c (diff)
downloadgit-465b26eeef79e3cb4cb6276e405e59d986069926.tar.gz
git-465b26eeef79e3cb4cb6276e405e59d986069926.tar.xz
Cleanup unpack_object_header to use only offsets.
If we're always incrementing both the offset and the pointer we aren't gaining anything by keeping both. Instead just use the offset since that's what we were given and what we are expected to return. Also using offset is likely to make it easier to remap the pack in the future should partial mapping of very large packs get implemented. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 461768c31..7f4145c18 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -917,23 +917,19 @@ static unsigned long unpack_object_header(struct packed_git *p, unsigned long of
enum object_type *type, unsigned long *sizep)
{
unsigned shift;
- unsigned char *pack, c;
+ unsigned char c;
unsigned long size;
if (offset >= p->pack_size)
die("object offset outside of pack file");
-
- pack = (unsigned char *) p->pack_base + offset;
- c = *pack++;
- offset++;
+ c = *((unsigned char *)p->pack_base + offset++);
*type = (c >> 4) & 7;
size = c & 15;
shift = 4;
while (c & 0x80) {
if (offset >= p->pack_size)
die("object offset outside of pack file");
- c = *pack++;
- offset++;
+ c = *((unsigned char *)p->pack_base + offset++);
size += (c & 0x7f) << shift;
shift += 7;
}