Skip to content

Commit 2dc69ee

Browse files
committed
Merge branch 'ds/use-get-be64'
Code clean-up. * ds/use-get-be64: packfile: use get_be64() for large offsets
2 parents 9238941 + ad622a2 commit 2dc69ee

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pack-revindex.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ static void create_pack_revindex(struct packed_git *p)
134134
if (!(off & 0x80000000)) {
135135
p->revindex[i].offset = off;
136136
} else {
137-
p->revindex[i].offset =
138-
((uint64_t)ntohl(*off_64++)) << 32;
139-
p->revindex[i].offset |=
140-
ntohl(*off_64++);
137+
p->revindex[i].offset = get_be64(off_64);
138+
off_64 += 2;
141139
}
142140
p->revindex[i].nr = i;
143141
}

packfile.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,8 +1713,7 @@ off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
17131713
return off;
17141714
index += p->num_objects * 4 + (off & 0x7fffffff) * 8;
17151715
check_pack_index_ptr(p, index);
1716-
return (((uint64_t)ntohl(*((uint32_t *)(index + 0)))) << 32) |
1717-
ntohl(*((uint32_t *)(index + 4)));
1716+
return get_be64(index);
17181717
}
17191718
}
17201719

0 commit comments

Comments
 (0)