From 757d223064eb8a924ac765b30addc7626fa16c31 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 10 Feb 2019 20:17:22 +0100 Subject: [PATCH] tweaks: don't bother executing two functions that are empty The get_history_older_void() and get_history_newer_void() functions are mere names, they don't actually do anything. So... don't bother to execute them, so the 'finished' variable doesn't have to be reset after calling them. Also, normalize the order of those two empty functions. --- src/history.c | 10 ++++------ src/prompt.c | 17 +++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/history.c b/src/history.c index b3530837..ec29c52b 100644 --- a/src/history.c +++ b/src/history.c @@ -167,14 +167,12 @@ char *get_history_newer(filestruct **h) return (*h)->data; } -/* More placeholders. */ -void get_history_newer_void(void) -{ - ; -} +/* Two empty placeholder functions. */ void get_history_older_void(void) { - ; +} +void get_history_newer_void(void) +{ } #ifdef ENABLE_TABCOMP diff --git a/src/prompt.c b/src/prompt.c index b5338a17..abfb0396 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -126,6 +126,11 @@ int do_statusbar_input(bool *finished) if (shortcut) { 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) + ; +#endif else if (shortcut->func == do_left) do_statusbar_left(); else if (shortcut->func == do_right) @@ -518,12 +523,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, answer = mallocstrcpy(answer, history); typing_x = strlen(answer); } - - /* This key has a shortcut-list entry when it's used to - * move to an older search, which means that finished has - * been set to TRUE. Set it back to FALSE here, so that - * we aren't kicked out of the statusbar prompt. */ - finished = FALSE; } } else if (func == get_history_newer_void) { if (history_list != NULL) { @@ -541,12 +540,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, answer = mallocstrcpy(answer, magichistory); typing_x = strlen(answer); } - - /* This key has a shortcut-list entry when it's used to - * move to a newer search, which means that finished has - * been set to TRUE. Set it back to FALSE here, so that - * we aren't kicked out of the statusbar prompt. */ - finished = FALSE; } } else #endif /* ENABLE_HISTORIES */