diff mbox series

[v2,2/7] pack-objects: pass "struct strvec *" instead of int/char ** pair

Message ID patch-v2-2.7-7f59a58ed97-20210912T001420Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series strvec: use size_t to store nr and alloc | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 12, 2021, 12:15 a.m. UTC
As in the preceding commit, prepare for the "nr" member of "struct
strvec" changing from an "int" to a "size_t".

In this case we end up passing the "nr" to setup_revisions(), which
expects to take an argc/argv pair passed to main(), so we can't change
its type.

But we can defer the conversion until that point. Let's continue to
pass the "struct strvec *" down into instead of "unwrapping" it in
cases where the only source of the "int/char **" pair is a "struct
strvec".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/pack-objects.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index ec8503563a6..1902c0b6776 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3701,7 +3701,7 @@  static void mark_bitmap_preferred_tips(void)
 	}
 }
 
-static void get_object_list(int ac, const char **av)
+static void get_object_list(struct strvec *rp)
 {
 	struct rev_info revs;
 	struct setup_revision_opt s_r_opt = {
@@ -3713,7 +3713,7 @@  static void get_object_list(int ac, const char **av)
 
 	repo_init_revisions(the_repository, &revs, NULL);
 	save_commit_buffer = 0;
-	setup_revisions(ac, av, &revs, &s_r_opt);
+	setup_revisions(rp->nr, rp->v, &revs, &s_r_opt);
 
 	/* make sure shallows are read */
 	is_repository_shallow(the_repository);
@@ -4138,7 +4138,7 @@  int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 	} else if (!use_internal_rev_list)
 		read_object_list_from_stdin();
 	else {
-		get_object_list(rp.nr, rp.v);
+		get_object_list(&rp);
 		strvec_clear(&rp);
 	}
 	cleanup_preferred_base();