ash,hush: drop pointer check before calls to show_history
authorRon Yorston <rmy@pobox.com>
Mon, 16 Dec 2019 09:31:10 +0000 (09:31 +0000)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 30 Apr 2020 15:30:02 +0000 (17:30 +0200)
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>
shell/ash.c
shell/hush.c

index a11b1d67dbe94ac8a57275e107bebcfbb8125847..2a4c839a70b25e321da46db833113a86e04cbf19 100644 (file)
@@ -13824,8 +13824,7 @@ helpcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 static int FAST_FUNC
 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;
 }
 #endif
index 0a92f5da7b6308b75dc91ac7f7107f06d97c1b44..cab7ea5b02a0d50c6e98dceecd82a8b808f57aa8 100644 (file)
@@ -10461,8 +10461,7 @@ static int FAST_FUNC builtin_help(char **argv UNUSED_PARAM)
 #if MAX_HISTORY && ENABLE_FEATURE_EDITING
 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;
 }
 #endif