ash,hush: drop pointer check before calls to show_history

show_history() checks that its argument in non-null so there's
no need to repeat the test at call sites.

function                                             old     new   delta
historycmd                                            25      17      -8
builtin_history                                       29      21      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16)             Total: -16 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Ron Yorston 2019-12-16 09:31:10 +00:00 committed by Denys Vlasenko
parent 981b2eff81
commit 9f3b410006
2 changed files with 2 additions and 4 deletions

View File

@ -13824,8 +13824,7 @@ helpcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
static int FAST_FUNC static int FAST_FUNC
historycmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) historycmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{ {
if (line_input_state) show_history(line_input_state);
show_history(line_input_state);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif #endif

View File

@ -10461,8 +10461,7 @@ static int FAST_FUNC builtin_help(char **argv UNUSED_PARAM)
#if MAX_HISTORY && ENABLE_FEATURE_EDITING #if MAX_HISTORY && ENABLE_FEATURE_EDITING
static int FAST_FUNC builtin_history(char **argv UNUSED_PARAM) static int FAST_FUNC builtin_history(char **argv UNUSED_PARAM)
{ {
if (G.line_input_state) show_history(G.line_input_state);
show_history(G.line_input_state);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
#endif #endif