Skip to content

Commit 970909c

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ef1b853 commit 970909c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

pack-write.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,10 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
153153
while (nr_large_offset) {
154154
struct pack_idx_entry *obj = *list++;
155155
uint64_t offset = obj->offset;
156-
uint32_t split[2];
157156

158157
if (!need_large_offset(offset, opts))
159158
continue;
160-
split[0] = htonl(offset >> 32);
161-
split[1] = htonl(offset & 0xffffffff);
162-
hashwrite(f, split, 8);
159+
hashwrite_be64(f, offset);
163160
nr_large_offset--;
164161
}
165162
}

0 commit comments

Comments
 (0)