diff mbox series

[4/8] pack-bitmap: drop redundant args from `bitmap_writer_finish()`

Message ID 819a0765f380e69d2ae53304214d77dcdbb7b91c.1723743050.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit 11a08e8332762ad0a56c7a92701d85d0d04f94a7
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
In a similar fashion as the previous commit, drop a redundant argument
from the `bitmap_writer_finish()` function.

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

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 97090433a1..e23c4950ed 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1370,7 +1370,7 @@  static void write_pack_file(void)
 				if (bitmap_writer_build(&bitmap_writer) < 0)
 					die(_("failed to write bitmap index"));
 				bitmap_writer_finish(&bitmap_writer,
-						     written_list, nr_written,
+						     written_list,
 						     tmpname.buf, write_bitmap_options);
 				bitmap_writer_free(&bitmap_writer);
 				write_bitmap_index = 0;
diff --git a/midx-write.c b/midx-write.c
index 1ccdf0df30..d2d13447af 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -851,8 +851,7 @@  static int write_midx_bitmap(const char *midx_name,
 		goto cleanup;
 
 	bitmap_writer_set_checksum(&writer, midx_hash);
-	bitmap_writer_finish(&writer, index, pdata->nr_objects, bitmap_name,
-			     options);
+	bitmap_writer_finish(&writer, index, bitmap_name, options);
 
 cleanup:
 	free(index);
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 8d7437955d..346fb29513 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -998,7 +998,6 @@  void bitmap_writer_set_checksum(struct bitmap_writer *writer,
 
 void bitmap_writer_finish(struct bitmap_writer *writer,
 			  struct pack_idx_entry **index,
-			  uint32_t index_nr,
 			  const char *filename,
 			  uint16_t options)
 {
@@ -1031,12 +1030,13 @@  void bitmap_writer_finish(struct bitmap_writer *writer,
 	dump_bitmap(f, writer->tags);
 
 	if (options & BITMAP_OPT_LOOKUP_TABLE)
-		CALLOC_ARRAY(offsets, index_nr);
+		CALLOC_ARRAY(offsets, writer->to_pack->nr_objects);
 
 	for (i = 0; i < bitmap_writer_nr_selected_commits(writer); i++) {
 		struct bitmapped_commit *stored = &writer->selected[i];
 		int commit_pos = oid_pos(&stored->commit->object.oid, index,
-					 index_nr, oid_access);
+					 writer->to_pack->nr_objects,
+					 oid_access);
 
 		if (commit_pos < 0)
 			BUG(_("trying to write commit not in index"));
@@ -1052,7 +1052,7 @@  void bitmap_writer_finish(struct bitmap_writer *writer,
 		write_lookup_table(writer, f, offsets);
 
 	if (options & BITMAP_OPT_HASH_CACHE)
-		write_hash_cache(f, index, index_nr);
+		write_hash_cache(f, index, writer->to_pack->nr_objects);
 
 	finalize_hashfile(f, NULL, FSYNC_COMPONENT_PACK_METADATA,
 			  CSUM_HASH_IN_STREAM | CSUM_FSYNC | CSUM_CLOSE);
diff --git a/pack-bitmap.h b/pack-bitmap.h
index 0c5b83e954..ff0fd815b8 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -149,7 +149,6 @@  void bitmap_writer_select_commits(struct bitmap_writer *writer,
 int bitmap_writer_build(struct bitmap_writer *writer);
 void bitmap_writer_finish(struct bitmap_writer *writer,
 			  struct pack_idx_entry **index,
-			  uint32_t index_nr,
 			  const char *filename,
 			  uint16_t options);
 void bitmap_writer_free(struct bitmap_writer *writer);