diff mbox series

[5/5] builtin/pack-objects.c: do not open-code `MAX_PACK_OBJECT_HEADER`

Message ID 82754d92509e364e96fe35ca20eb709eb6f38641.1724793201.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit d3e7db2b8285e3ac3e9c28df51eab8237bf9c700
Headers show
Series pack-objects: brown-paper-bag fixes for multi-pack reuse | expand

Commit Message

Taylor Blau Aug. 27, 2024, 9:13 p.m. UTC
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>
---
 builtin/pack-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 700adfb5a8..c6e2852d3c 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -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;