git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 27, 2024, 21:13 UTC
Message-ID
<82754d92509e364e96fe35ca20eb709eb6f38641.1724793201.git.me@ttaylorr.com>
In-Reply-To
<cover.1724793201.git.me@ttaylorr.com>

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 --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;
 
-- 
2.46.0.426.g82754d92509
Previous: Taylor BlauNext: Junio C Hamano
Message 13 of 17 in “pack-objects: brown-paper-bag fixes for multi-pack reuse”
  1. 0/5 pack-objects: brown-paper-bag fixes for multi-pack reuseTaylor Blau, Aug 27, 2024
  2. 1/5 t/t5332-multi-pack-reuse.sh: verify pack generation with --strictTaylor Blau, Aug 27, 2024
  3. 2/5 pack-bitmap: tag bitmapped packs with their corresponding MIDXTaylor Blau, Aug 27, 2024
  4. Junio C HamanoAug 28, 2024
  5. Taylor BlauAug 29, 2024
  6. Jeff KingSep 5, 2024
  7. Taylor BlauSep 17, 2024
  8. 3/5 builtin/pack-objects.c: translate bit positions during pack-reuseTaylor Blau, Aug 27, 2024
  9. Junio C HamanoSep 4, 2024
  10. 4/5 pack-bitmap.c: avoid repeated `pack_pos_to_offset()` during reuseTaylor Blau, Aug 27, 2024
  11. Junio C HamanoSep 4, 2024
  12. Taylor BlauSep 4, 2024
  13. 5/5 builtin/pack-objects.c: do not open-code `MAX_PACK_OBJECT_HEADER`Taylor Blau, Aug 27, 2024
  14. Junio C HamanoSep 4, 2024
  15. Taylor BlauSep 4, 2024
  16. Jeff KingSep 5, 2024
  17. Junio C HamanoSep 5, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.