summaryrefslogtreecommitdiff
path: root/pack-write.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2020-11-12 12:23:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-12 17:40:10 (GMT)
commit970909c2a7803564f82ab1d3660d77ad6a44b68f (patch)
tree8212b09792c126b8a4a06f2b3d7e79de84350eeb /pack-write.c
parentef1b853c15d443b057e5a6306c89b869168a8270 (diff)
downloadgit-970909c2a7803564f82ab1d3660d77ad6a44b68f.zip
git-970909c2a7803564f82ab1d3660d77ad6a44b68f.tar.gz
git-970909c2a7803564f82ab1d3660d77ad6a44b68f.tar.bz2
pack-write: use hashwrite_be64()
Call hashwrite_be64() to write a 64-bit value instead of open-coding it using htonl() and hashwrite(). This shortens the code, gets rid of a buffer and several magic numbers, and makes the intent clearer. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-write.c')
-rw-r--r--pack-write.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/pack-write.c b/pack-write.c
index a6cdb3c..4bdd44c 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -153,13 +153,10 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
while (nr_large_offset) {
struct pack_idx_entry *obj = *list++;
uint64_t offset = obj->offset;
- uint32_t split[2];
if (!need_large_offset(offset, opts))
continue;
- split[0] = htonl(offset >> 32);
- split[1] = htonl(offset & 0xffffffff);
- hashwrite(f, split, 8);
+ hashwrite_be64(f, offset);
nr_large_offset--;
}
}