[PATCH] ash,hush: drop pointer check before calls to show_history
Ron Yorston
rmy at pobox.com
Mon Dec 16 09:31:10 UTC 2019
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 at pobox.com>
---
shell/ash.c | 3 +--
shell/hush.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index 4b5eafa7c..c723f782c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13739,8 +13739,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
diff --git a/shell/hush.c b/shell/hush.c
index 97202b953..871f8f1fb 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -10396,8 +10396,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
--
2.23.0
More information about the busybox
mailing list