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>maint
parent
7a4acc3607
commit
4985f72ea5
|
|
@ -477,7 +477,7 @@ static int find_unique(const char *choice, struct menu_stuff *menu_stuff)
|
||||||
*/
|
*/
|
||||||
static int parse_choice(struct menu_stuff *menu_stuff,
|
static int parse_choice(struct menu_stuff *menu_stuff,
|
||||||
int is_single,
|
int is_single,
|
||||||
struct strbuf *input,
|
char *input,
|
||||||
int **chosen)
|
int **chosen)
|
||||||
{
|
{
|
||||||
struct string_list choice = STRING_LIST_INIT_NODUP;
|
struct string_list choice = STRING_LIST_INIT_NODUP;
|
||||||
|
|
@ -485,7 +485,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
|
||||||
int nr = 0;
|
int nr = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
string_list_split_in_place_f(&choice, input->buf,
|
string_list_split_in_place_f(&choice, input,
|
||||||
is_single ? "\n" : ", ", -1,
|
is_single ? "\n" : ", ", -1,
|
||||||
STRING_LIST_SPLIT_TRIM);
|
STRING_LIST_SPLIT_TRIM);
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
|
||||||
|
|
||||||
nr = parse_choice(stuff,
|
nr = parse_choice(stuff,
|
||||||
opts->flags & MENU_OPTS_SINGLETON,
|
opts->flags & MENU_OPTS_SINGLETON,
|
||||||
&choice,
|
choice.buf,
|
||||||
&chosen);
|
&chosen);
|
||||||
|
|
||||||
if (opts->flags & MENU_OPTS_SINGLETON) {
|
if (opts->flags & MENU_OPTS_SINGLETON) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue