]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-write: use hashwrite_be64()
authorRené Scharfe <l.s.r@web.de>
Thu, 12 Nov 2020 12:23:10 +0000 (13:23 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Nov 2020 17:40:10 +0000 (09:40 -0800)
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>
pack-write.c

index a6cdb3c67ccac3a0cb273d4e4d24bd35ac2b4bf4..4bdd44cf7359e47a78f32bf75be1711fdcc632c9 100644 (file)
@@ -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--;
                }
        }