diff mbox series

[2/8] pack-bitmap: drop redundant args from `bitmap_writer_build_type_index()`

Message ID 238ca46998e936fb5d57467aeec5d9a0b187341e.1723743050.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit 125ee4ae80e3661c3208fc1c8db0c619e5f625d2
Headers show
Series pseudo-merge: avoid empty and non-closed pseudo-merge commits | expand

Commit Message

Taylor Blau Aug. 15, 2024, 5:31 p.m. UTC
The previous commit ensures that the bitmap_writer's "to_pack" field is
initialized early on, so the "to_pack" and "index_nr" arguments to
`bitmap_writer_build_type_index()` are redundant.

Drop them and adjust the callers accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 builtin/pack-objects.c |  2 +-
 midx-write.c           |  3 +--
 pack-bitmap-write.c    | 12 +++++-------
 pack-bitmap.h          |  4 +---
 4 files changed, 8 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 0ad533c045..c08a62718d 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1345,7 +1345,7 @@  static void write_pack_file(void)
 						   the_repository, &to_pack);
 				bitmap_writer_set_checksum(&bitmap_writer, hash);
 				bitmap_writer_build_type_index(&bitmap_writer,
-					&to_pack, written_list, nr_written);
+							       written_list);
 			}
 
 			if (cruft)
diff --git a/midx-write.c b/midx-write.c
index 62f507eb72..b3015af07f 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -827,8 +827,7 @@  static int write_midx_bitmap(const char *midx_name,
 
 	bitmap_writer_init(&writer, the_repository, pdata);
 	bitmap_writer_show_progress(&writer, flags & MIDX_PROGRESS);
-	bitmap_writer_build_type_index(&writer, pdata, index,
-				       pdata->nr_objects);
+	bitmap_writer_build_type_index(&writer, index);
 
 	/*
 	 * bitmap_writer_finish expects objects in lex order, but pack_order
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 4a7d2d1370..34cdf5f150 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -101,9 +101,7 @@  void bitmap_writer_show_progress(struct bitmap_writer *writer, int show)
  * Build the initial type index for the packfile or multi-pack-index
  */
 void bitmap_writer_build_type_index(struct bitmap_writer *writer,
-				    struct packing_data *to_pack,
-				    struct pack_idx_entry **index,
-				    uint32_t index_nr)
+				    struct pack_idx_entry **index)
 {
 	uint32_t i;
 
@@ -111,13 +109,13 @@  void bitmap_writer_build_type_index(struct bitmap_writer *writer,
 	writer->trees = ewah_new();
 	writer->blobs = ewah_new();
 	writer->tags = ewah_new();
-	ALLOC_ARRAY(to_pack->in_pack_pos, to_pack->nr_objects);
+	ALLOC_ARRAY(writer->to_pack->in_pack_pos, writer->to_pack->nr_objects);
 
-	for (i = 0; i < index_nr; ++i) {
+	for (i = 0; i < writer->to_pack->nr_objects; ++i) {
 		struct object_entry *entry = (struct object_entry *)index[i];
 		enum object_type real_type;
 
-		oe_set_in_pack_pos(to_pack, entry, i);
+		oe_set_in_pack_pos(writer->to_pack, entry, i);
 
 		switch (oe_type(entry)) {
 		case OBJ_COMMIT:
@@ -128,7 +126,7 @@  void bitmap_writer_build_type_index(struct bitmap_writer *writer,
 			break;
 
 		default:
-			real_type = oid_object_info(to_pack->repo,
+			real_type = oid_object_info(writer->to_pack->repo,
 						    &entry->idx.oid, NULL);
 			break;
 		}
diff --git a/pack-bitmap.h b/pack-bitmap.h
index ab20d6a0b6..d2529abadc 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -129,9 +129,7 @@  void bitmap_writer_show_progress(struct bitmap_writer *writer, int show);
 void bitmap_writer_set_checksum(struct bitmap_writer *writer,
 				const unsigned char *sha1);
 void bitmap_writer_build_type_index(struct bitmap_writer *writer,
-				    struct packing_data *to_pack,
-				    struct pack_idx_entry **index,
-				    uint32_t index_nr);
+				    struct pack_idx_entry **index);
 int bitmap_writer_has_bitmapped_object_id(struct bitmap_writer *writer,
 					  const struct object_id *oid);
 void bitmap_writer_push_commit(struct bitmap_writer *writer,