From e40e6bbf1027d1ce708a93aa5b152d87f94b7f56 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 11 Aug 2018 09:51:33 +0200 Subject: [PATCH] tweaks: rename a function to better match its counterpart Also rename its parameter, to describe what it ought to be. --- src/global.c | 6 +++--- src/proto.h | 4 +++- src/rcfile.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/global.c b/src/global.c index 136058e0..4ac369b5 100644 --- a/src/global.c +++ b/src/global.c @@ -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; diff --git a/src/proto.h b/src/proto.h index 725543ab..b59ba0b4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -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 diff --git a/src/rcfile.c b/src/rcfile.c index d9b78a48..08de4d67 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -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;