From e9f0597e2efa9515176d7d3472604463e512b91f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 9 Oct 2021 17:30:33 +0200 Subject: [PATCH] tweaks: rename two empty functions, to be more to the point Also, move them to global.c, where all the other empty functions are. --- src/global.c | 24 ++++++++++++++++-------- src/history.c | 8 -------- src/prompt.c | 8 ++++---- src/prototypes.h | 6 ++++-- src/rcfile.c | 4 ++-- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/global.c b/src/global.c index 454e1299..6ccb106e 100644 --- a/src/global.c +++ b/src/global.c @@ -291,6 +291,14 @@ void regexp_void(void) void backwards_void(void) { } +#ifdef ENABLE_HISTORIES +void get_older_item(void) +{ +} +void get_newer_item(void) +{ +} +#endif void flip_replace(void) { } @@ -851,9 +859,9 @@ void shortcut_init(void) N_("No Replace"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW); #ifdef ENABLE_HISTORIES - add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, + add_to_funcs(get_older_item, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, N_("Older"), WITHORSANS(older_gist), TOGETHER, VIEW); - add_to_funcs(get_history_newer_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, + add_to_funcs(get_newer_item, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, N_("Newer"), WITHORSANS(newer_gist), BLANKAFTER, VIEW); #endif @@ -1426,17 +1434,17 @@ void shortcut_init(void) add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0); add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0); #ifdef ENABLE_HISTORIES - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_history_older_void, 0); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_history_newer_void, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_older_item, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_newer_item, 0); #ifdef ENABLE_UTF8 if (using_utf8()) { - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xb4", KEY_UP, get_history_older_void, 0); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xbe", KEY_DOWN, get_history_newer_void, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xb4", KEY_UP, get_older_item, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xbe", KEY_DOWN, get_newer_item, 0); } else #endif { - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Up", KEY_UP, get_history_older_void, 0); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Down", KEY_DOWN, get_history_newer_void, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Up", KEY_UP, get_older_item, 0); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Down", KEY_DOWN, get_newer_item, 0); } #endif #ifdef ENABLE_JUSTIFY diff --git a/src/history.c b/src/history.c index bfcb183c..985413df 100644 --- a/src/history.c +++ b/src/history.c @@ -145,14 +145,6 @@ void update_history(linestruct **item, const char *text) *item = *hbot; } -/* Two empty placeholder functions. */ -void get_history_older_void(void) -{ -} -void get_history_newer_void(void) -{ -} - #ifdef ENABLE_TABCOMP /* Go backward through one of three history lists, starting at its item h, * searching for a string that is a tab completion of the given string s, diff --git a/src/prompt.c b/src/prompt.c index ec50e18f..44a12fbe 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -304,8 +304,8 @@ int do_statusbar_input(bool *finished) if (shortcut->func == do_tab || shortcut->func == do_enter) ; #ifdef ENABLE_HISTORIES - else if (shortcut->func == get_history_older_void || - shortcut->func == get_history_newer_void) + else if (shortcut->func == get_older_item || + shortcut->func == get_newer_item) ; #endif else if (shortcut->func == do_left) @@ -504,7 +504,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed, } else #endif /* ENABLE_TABCOMP */ #ifdef ENABLE_HISTORIES - if (func == get_history_older_void) { + if (func == get_older_item) { if (history_list != NULL) { /* If we're scrolling up at the bottom of the history list * and answer isn't blank, save answer in magichistory. */ @@ -519,7 +519,7 @@ functionptrtype acquire_an_answer(int *actual, bool *listed, typing_x = strlen(answer); } } - } else if (func == get_history_newer_void) { + } else if (func == get_newer_item) { if (history_list != NULL) { /* Get the newer search from the history list and save it in * answer. If there is no newer search, don't do anything. */ diff --git a/src/prototypes.h b/src/prototypes.h index 1b749142..5fd59b52 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -336,8 +336,6 @@ void do_help(void); void history_init(void); void history_reset(const linestruct *list); void update_history(linestruct **item, const char *text); -void get_history_older_void(void); -void get_history_newer_void(void); #ifdef ENABLE_TABCOMP char *get_history_completion(linestruct **h, char *s, size_t len); #endif @@ -632,6 +630,10 @@ void do_credits(void); void case_sens_void(void); void regexp_void(void); void backwards_void(void); +#ifdef ENABLE_HISTORIES +void get_older_item(void); +void get_newer_item(void); +#endif void flip_replace(void); void flip_goto(void); #ifdef ENABLE_BROWSER diff --git a/src/rcfile.c b/src/rcfile.c index ca39a8d1..1943b41a 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -409,9 +409,9 @@ keystruct *strtosc(const char *input) s->func = flip_goto; #ifdef ENABLE_HISTORIES else if (!strcmp(input, "older")) - s->func = get_history_older_void; + s->func = get_older_item; else if (!strcmp(input, "newer")) - s->func = get_history_newer_void; + s->func = get_newer_item; #endif #ifndef NANO_TINY else if (!strcmp(input, "dosformat"))