From 7a1959fb11e1b233c7b383fd4e29dac9009c8de2 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 16 Aug 2015 09:28:33 +0000 Subject: [PATCH] Not bothering to pass around a function when it's used only once. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5361 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/help.c | 23 +++++++++++------------ src/proto.h | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc4ba21f..583f487e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ in the help screens: wrap them at 74 columns if the screen is wider. * src/help.c (help_init): Reduce the scope of a variable. * src/help.c: Adjust some comments and whitespace. + * src/help.c (do_help, do_help_void): Don't bother passing a function + when it's used only once. 2015-08-13 Benno Schulenberg * src/search.c (do_find_bracket): Remove mistaken comparison between diff --git a/src/help.c b/src/help.c index 51275689..e9f0e272 100644 --- a/src/help.c +++ b/src/help.c @@ -36,9 +36,8 @@ static char *end_of_intro = NULL; /* The point in the help text where the introductory paragraphs end * and the shortcut descriptions begin. */ -/* Our main help browser function. refresh_func is the function we will - * call to refresh the edit window. */ -void do_help(void (*refresh_func)(void)) +/* Our main help-viewer function. */ +void do_help(void) { int kbinput = ERR; bool old_no_help = ISSET(NO_HELP); @@ -176,7 +175,13 @@ void do_help(void (*refresh_func)(void)) bottombars(oldmenu); curs_set(1); - refresh_func(); + +#ifndef DISABLE_BROWSER + if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR) + browser_refresh(); + else +#endif + edit_refresh(); /* The help_init() at the beginning allocated help_text. Since * help_text has now been written to the screen, we don't need it @@ -522,17 +527,11 @@ size_t help_line_len(const char *ptr) #endif /* !DISABLE_HELP */ -/* Start the help browser. */ +/* Start the help viewer. */ void do_help_void(void) { #ifndef DISABLE_HELP - /* Start the help browser, with the correct refresher for afterwards. */ -#ifndef DISABLE_BROWSER - if (currmenu == MBROWSER || currmenu == MWHEREISFILE || currmenu == MGOTODIR) - do_help(&browser_refresh); - else -#endif - do_help(&edit_refresh); + do_help(); #else if (currmenu == MMAIN) say_there_is_no_help(); diff --git a/src/proto.h b/src/proto.h index b975b1a4..2192b151 100644 --- a/src/proto.h +++ b/src/proto.h @@ -374,7 +374,7 @@ void thanks_for_all_the_fish(void); /* All functions in help.c. */ #ifndef DISABLE_HELP -void do_help(void (*refresh_func)(void)); +void do_help(void); void help_init(void); functionptrtype parse_help_input(int *kbinput); size_t help_line_len(const char *ptr);