]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/pack-objects.c: do not open-code `MAX_PACK_OBJECT_HEADER`
authorTaylor Blau <me@ttaylorr.com>
Tue, 27 Aug 2024 21:13:39 +0000 (17:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Aug 2024 21:50:27 +0000 (14:50 -0700)
The function `write_reused_pack_one()` defines an header to store the
OFS_DELTA header, but uses the constant "10" instead of
"MAX_PACK_OBJECT_HEADER" (as is done elsewhere in the same patch, circa
bb514de356c (pack-objects: improve partial packfile reuse, 2019-12-18)).

Declare the `ofs_header` field to be sized according to
`MAX_PACK_OBJECT_HEADER` (which is 10, as defined in "pack.h") instead
of the constant 10.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c

index 700adfb5a8add79e73e055d97b2f972afa0983bc..c6e2852d3ca57f63126d3aa8402d65563bba60ee 100644 (file)
@@ -1072,7 +1072,7 @@ static void write_reused_pack_one(struct packed_git *reuse_packfile,
                fixup = find_reused_offset(offset) -
                        find_reused_offset(base_offset);
                if (fixup) {
-                       unsigned char ofs_header[10];
+                       unsigned char ofs_header[MAX_PACK_OBJECT_HEADER];
                        unsigned i, ofs_len;
                        off_t ofs = offset - base_offset - fixup;