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

[PATCH 06/10] pack-objects: drop unused parameter from oe_map_new_pack()

From
Jeff King <peff@peff.net>
Date
Feb 14, 2019, 05:50 UTC
Message-ID
<20190214055031.GF20578@sigill.intra.peff.net>
In-Reply-To
<20190214054736.GA20091@sigill.intra.peff.net>

Since 43fa44fa3b (pack-objects: move in_pack out of struct object_entry, 2018-04-14), we store the source pack for each object as a small index rather than as a pointer. When we see a new pack that has no allocated index, we fall back to generating an array of pointers by calling oe_map_new_pack().

Perhaps counter-intuitively, that function does not need to actually see our new index-less pack. It only allocates and populates the array with the existing packs, after which oe_set_in_pack() actually adds the new pack to the array.

Let's drop the unused "struct packed_git" argument to oe_map_new_pack() to avoid confusion.

Signed-off-by: Jeff King <peff@peff.net>
---
 pack-objects.c | 3 +--
 pack-objects.h | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/pack-objects.c b/pack-objects.c
index e7cd337bee..ce33b8906e 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -119,8 +119,7 @@ static void prepare_in_pack_by_idx(struct packing_data *pdata)
  * this fall back code, just stay simple and fall back to using
  * in_pack[] array.
  */
-void oe_map_new_pack(struct packing_data *pack,
-		     struct packed_git *p)
+void oe_map_new_pack(struct packing_data *pack)
 {
 	uint32_t i;
 
diff --git a/pack-objects.h b/pack-objects.h
index 6bfacc7d2c..6fde7ce27c 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -247,14 +247,14 @@ static inline struct packed_git *oe_in_pack(const struct packing_data *pack,
 		return pack->in_pack[e - pack->objects];
 }
 
-void oe_map_new_pack(struct packing_data *pack,
-		     struct packed_git *p);
+void oe_map_new_pack(struct packing_data *pack);
+
 static inline void oe_set_in_pack(struct packing_data *pack,
 				  struct object_entry *e,
 				  struct packed_git *p)
 {
 	if (!p->index)
-		oe_map_new_pack(pack, p);
+		oe_map_new_pack(pack);
 	if (pack->in_pack_by_idx)
 		e->in_pack_idx = p->index;
 	else
-- 
2.21.0.rc1.567.g648f076c3f
Previous: Jeff KingNext: Jeff King
Message 7 of 11 in “dropping more unused function parameters”
  1. 0/10 dropping more unused function parametersJeff King, Feb 14, 2019
  2. 01/10 diff: drop options parameter from diffcore_fix_diff_index()Jeff King, Feb 14, 2019
  3. 02/10 diff: drop unused color reset parametersJeff King, Feb 14, 2019
  4. 03/10 diff: drop unused emit data parameter from sane_truncate_line()Jeff King, Feb 14, 2019
  5. 04/10 diff: drop complete_rewrite parameter from run_external_diff()Jeff King, Feb 14, 2019
  6. 05/10 merge-recursive: drop several unused parametersJeff King, Feb 14, 2019
  7. 06/10 pack-objects: drop unused parameter from oe_map_new_pack()Jeff King, Feb 14, 2019
  8. 07/10 files-backend: drop refs parameter from split_symref_update()Jeff King, Feb 14, 2019
  9. 08/10 ref-filter: drop unused buf/sz pairsJeff King, Feb 14, 2019
  10. 09/10 ref-filter: drop unused "obj" parametersJeff King, Feb 14, 2019
  11. 10/10 ref-filter: drop unused "sz" parametersJeff King, Feb 14, 2019

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.