clean: do not pass the whole structure when it is not necessary
The callee parse_choice() only needs to access a NUL-terminated string; instead of insisting to take a pointer to a strbuf, just take a pointer to a character array. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Aug 2, 2025 at 22:42 UTC
4985f72ea5133441c2e9ba808bdea861a2d9f042
1 file changed
+3
-3
builtin/clean.c
+3
-3
@@ -477,7 +477,7 @@ static int find_unique(const char *choice, struct menu_stuff *menu_stuff)
477
*/
478
static int parse_choice(struct menu_stuff *menu_stuff,
479
int is_single,
480
- struct strbuf *input,
480
+ char *input,
481
int **chosen)
482
{
483
struct string_list choice = STRING_LIST_INIT_NODUP;
@@ -485,7 +485,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
485
int nr = 0;
486
int i;
487
488
- string_list_split_in_place_f(&choice, input->buf,
488
+ string_list_split_in_place_f(&choice, input,
489
is_single ? "\n" : ", ", -1,
490
STRING_LIST_SPLIT_TRIM);
491
@@ -626,7 +626,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
626
627
nr = parse_choice(stuff,
628
opts->flags & MENU_OPTS_SINGLETON,
629
- &choice,
629
+ choice.buf,
630
&chosen);
631
632
if (opts->flags & MENU_OPTS_SINGLETON) {