tweaks: rename a function to better match its counterpart

Also rename its parameter, to describe what it ought to be.
master
Benno Schulenberg 2018-08-11 09:51:33 +02:00
parent 2147e161bf
commit e40e6bbf10
3 changed files with 7 additions and 5 deletions

View File

@ -1699,13 +1699,13 @@ sc *strtosc(const char *input)
return s;
}
/* Interpret a menu name and return the corresponding menu flag. */
int strtomenu(const char *input)
/* Return the symbol that corresponds to the given menu name. */
int name_to_menu(const char *name)
{
int index = -1;
while (++index < NUMBER_OF_MENUS)
if (strcasecmp(input, menunames[index]) == 0)
if (strcasecmp(name, menunames[index]) == 0)
return menusymbols[index];
return -1;

View File

@ -328,9 +328,11 @@ void set_speller_shortcut(void);
#endif
const subnfunc *sctofunc(const sc *s);
const char *flagtostr(int flag);
#ifdef ENABLE_NANORC
sc *strtosc(const char *input);
int strtomenu(const char *input);
int name_to_menu(const char *name);
char *menu_to_name(int menu);
#endif
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif

View File

@ -422,7 +422,7 @@ void parse_binding(char *ptr, bool dobind)
}
}
menu = strtomenu(menuptr);
menu = name_to_menu(menuptr);
if (menu < 1) {
rcfile_error(N_("Cannot map name \"%s\" to a menu"), menuptr);
goto free_things;