From 7828a8096e119e4e63aee20c42d97972a500dda6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 14 Apr 2014 09:22:29 +0000 Subject: [PATCH] Removing the unused parameter 'func_key' from get_shortcut(). git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4768 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/browser.c | 15 +++++++-------- src/files.c | 4 ++-- src/help.c | 13 ++++++------- src/nano.c | 2 +- src/prompt.c | 6 +++--- src/proto.h | 7 +++---- src/search.c | 2 +- src/text.c | 4 ++-- src/winio.c | 22 +++++++++------------- 10 files changed, 36 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65948c02..81e067ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2014-04-14 Benno Schulenberg * src/{proto.h,cut.c,nano.c,text.c}: Remove the unused parameter 'file_bot' from copy_from_filestruct(), and rename the other. + * src/*: Remove the unused parameter 'func_key' from get_shortcut(), + and subsequently from parse_browser_input() and parse_help_input(). 2014-04-13 Benno Schulenberg * proto.h, global.c, rcfile.c: Remove the unused parameter 'menu' diff --git a/src/browser.c b/src/browser.c index d62e881d..11251c2c 100644 --- a/src/browser.c +++ b/src/browser.c @@ -161,8 +161,8 @@ char *do_browser(char *path, DIR *dir) } #endif /* !DISABLE_MOUSE */ - parse_browser_input(&kbinput, &meta_key, &func_key); - s = get_shortcut(MBROWSER, &kbinput, &meta_key, &func_key); + parse_browser_input(&kbinput, &meta_key); + s = get_shortcut(MBROWSER, &kbinput, &meta_key); if (!s) continue; f = sctofunc((sc *) s); @@ -540,13 +540,12 @@ void browser_init(const char *path, DIR *dir) } /* Determine the shortcut key corresponding to the values of kbinput - * (the key itself), meta_key (whether the key is a meta sequence), and - * func_key (whether the key is a function key), if any. In the - * process, convert certain non-shortcut keys into their corresponding + * (the key itself) and meta_key (whether the key is a meta sequence). + * Also convert certain non-shortcut keys into their corresponding * shortcut keys. */ -void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key) +void parse_browser_input(int *kbinput, bool *meta_key) { - get_shortcut(MBROWSER, kbinput, meta_key, func_key); + get_shortcut(MBROWSER, kbinput, meta_key); /* Pico compatibility. */ if (!*meta_key) { @@ -830,7 +829,7 @@ int filesearch_init(void) statusbar(_("Cancelled")); return -1; } else { - s = get_shortcut(MBROWSER, &i, &meta_key, &func_key); + s = get_shortcut(MBROWSER, &i, &meta_key); if (i == -2 || i == 0) { #ifdef HAVE_REGEX_H /* Use last_search if answer is an empty string, or diff --git a/src/files.c b/src/files.c index bf11f388..6ce73034 100644 --- a/src/files.c +++ b/src/files.c @@ -1070,7 +1070,7 @@ void do_insertfile( ans = mallocstrcpy(ans, answer); - s = get_shortcut(currmenu, &i, &meta_key, &func_key); + s = get_shortcut(currmenu, &i, &meta_key); #ifndef NANO_TINY #ifndef DISABLE_MULTIBUFFER @@ -2290,7 +2290,7 @@ bool do_writeout(bool exiting) break; } else { ans = mallocstrcpy(ans, answer); - s = get_shortcut(currmenu, &i, &meta_key, &func_key); + s = get_shortcut(currmenu, &i, &meta_key); #ifndef DISABLE_BROWSER if (s && s->scfunc == to_files_void) { diff --git a/src/help.c b/src/help.c index dd84124b..7d3c7c9e 100644 --- a/src/help.c +++ b/src/help.c @@ -137,8 +137,8 @@ void do_help(void (*refresh_func)(void)) } #endif - parse_help_input(&kbinput, &meta_key, &func_key); - s = get_shortcut(MHELP, &kbinput, &meta_key, &func_key); + parse_help_input(&kbinput, &meta_key); + s = get_shortcut(MHELP, &kbinput, &meta_key); if (!s) continue; f = sctofunc((sc *) s); @@ -486,13 +486,12 @@ void help_init(void) } /* Determine the shortcut key corresponding to the values of kbinput - * (the key itself), meta_key (whether the key is a meta sequence), and - * func_key (whether the key is a function key), if any. In the - * process, convert certain non-shortcut keys into their corresponding + * (the key itself) and meta_key (whether the key is a meta sequence). + * Also convert certain non-shortcut keys into their corresponding * shortcut keys. */ -void parse_help_input(int *kbinput, bool *meta_key, bool *func_key) +void parse_help_input(int *kbinput, bool *meta_key) { - get_shortcut(MHELP, kbinput, meta_key, func_key); + get_shortcut(MHELP, kbinput, meta_key); if (!*meta_key) { switch (*kbinput) { diff --git a/src/nano.c b/src/nano.c index cc59a9b9..aac4afc5 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1616,7 +1616,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool #endif /* Check for a shortcut in the main list. */ - s = get_shortcut(MMAIN, &input, meta_key, func_key); + s = get_shortcut(MMAIN, &input, meta_key); /* If we got a shortcut from the main list, or a "universal" * edit window shortcut, set have_shortcut to TRUE. */ diff --git a/src/prompt.c b/src/prompt.c index dbc5ac56..67d914da 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -88,7 +88,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut, #endif /* Check for a shortcut in the current list. */ - s = get_shortcut(currmenu, &input, meta_key, func_key); + s = get_shortcut(currmenu, &input, meta_key); /* If we got a shortcut from the current list, or a "universal" * statusbar prompt shortcut, set have_shortcut to TRUE. */ @@ -975,7 +975,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe &ran_func, &finished, TRUE, refresh_func); assert(statusbar_x <= strlen(answer)); - s = get_shortcut(currmenu, &kbinput, meta_key, func_key); + s = get_shortcut(currmenu, &kbinput, meta_key); if (s) if (s->scfunc == do_cancel || s->scfunc == do_enter_void) @@ -1294,7 +1294,7 @@ int do_yesno_prompt(bool all, const char *msg) currmenu = MYESNO; kbinput = get_kbinput(bottomwin, &meta_key, &func_key); - s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); + s = get_shortcut(currmenu, &kbinput, &meta_key); if (s && s->scfunc == do_cancel) ok = -1; diff --git a/src/proto.h b/src/proto.h index 7dbb90b5..090b2022 100644 --- a/src/proto.h +++ b/src/proto.h @@ -136,7 +136,7 @@ extern char *homedir; char *do_browser(char *path, DIR *dir); char *do_browse_from(const char *inpath); void browser_init(const char *path, DIR *dir); -void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key); +void parse_browser_input(int *kbinput, bool *meta_key); void browser_refresh(void); bool browser_select_filename(const char *needle); int filesearch_init(void); @@ -367,7 +367,7 @@ void do_help_void(void); #ifndef DISABLE_HELP void do_help(void (*refresh_func)(void)); void help_init(void); -void parse_help_input(int *kbinput, bool *meta_key, bool *func_key); +void parse_help_input(int *kbinput, bool *meta_key); size_t help_line_len(const char *ptr); #endif @@ -767,8 +767,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); #ifndef DISABLE_MOUSE int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); #endif -const sc *get_shortcut(int menu, int *kbinput, bool - *meta_key, bool *func_key); +const sc *get_shortcut(int menu, int *kbinput, bool *meta_key); const sc *first_sc_for(int menu, void (*func)(void)); void blank_line(WINDOW *win, int y, int x, int n); void blank_titlebar(void); diff --git a/src/search.c b/src/search.c index 24665e39..3f200e8e 100644 --- a/src/search.c +++ b/src/search.c @@ -1042,8 +1042,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, return; } + s = get_shortcut(currmenu, &i, &meta_key); - s = get_shortcut(currmenu, &i, &meta_key, &func_key); if (s && s->scfunc == gototext_void) { /* Keep answer up on the statusbar. */ search_init(TRUE, TRUE); diff --git a/src/text.c b/src/text.c index 938671e7..3a6e42be 100644 --- a/src/text.c +++ b/src/text.c @@ -2289,7 +2289,7 @@ void do_justify(bool full_justify) * the keystroke and return. */ kbinput = do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished, FALSE); - s = get_shortcut(MMAIN, &kbinput, &meta_key, &func_key); + s = get_shortcut(MMAIN, &kbinput, &meta_key); if (s && s->scfunc == do_uncut_text) { /* Splice the justify buffer back into the file, but only if we @@ -3243,7 +3243,7 @@ void do_linter(void) } kbinput = get_kbinput(bottomwin, &meta_key, &func_key); - s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); + s = get_shortcut(currmenu, &kbinput, &meta_key); tmplint = curlint; if (!s) diff --git a/src/winio.c b/src/winio.c index 0e2d6624..348b05df 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1762,21 +1762,16 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) } #endif /* !DISABLE_MOUSE */ -/* Return the shortcut corresponding to the values of kbinput (the key - * itself), meta_key (whether the key is a meta sequence), and func_key - * (whether the key is a function key), if any. The shortcut will be - * the first one in the list (control key, meta key sequence, function - * key, other meta key sequence) for the corresponding function. For - * example, passing in a meta key sequence that corresponds to a - * function with a control key, a function key, and a meta key sequence - * will return the control key corresponding to that function. */ -const sc *get_shortcut(int menu, int *kbinput, bool - *meta_key, bool *func_key) +/* Return the shortcut that corresponds to the values of kbinput (the + * key itself) and meta_key (whether the key is a meta sequence). The + * returned shortcut will be the first in the list that corresponds to + * the given sequence. */ +const sc *get_shortcut(int menu, int *kbinput, bool *meta_key) { sc *s; #ifdef DEBUG - fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s, func_key = %s\n", *kbinput, *meta_key ? "TRUE" : "FALSE", *func_key ? "TRUE" : "FALSE"); + fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s", *kbinput, *meta_key ? "TRUE" : "FALSE"); #endif /* Check for shortcuts. */ @@ -1785,7 +1780,8 @@ const sc *get_shortcut(int menu, int *kbinput, bool && ((s->type == META && *meta_key == TRUE && *kbinput == s->seq) || (s->type != META && *kbinput == s->seq))) { #ifdef DEBUG - fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menus %x = %x)\n", s->keystr, *meta_key, menu, s->menu); + fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menu is %x from %x)\n", + s->keystr, *meta_key, menu, s->menu); #endif return s; } @@ -1811,7 +1807,7 @@ const subnfunc *getfuncfromkey(WINDOW *win) if (kbinput == 0) return NULL; - s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); + s = get_shortcut(currmenu, &kbinput, &meta_key); if (!s) return NULL; -- 2.39.5