[git commit] ash, hush: drop pointer check before calls to show_history
Denys Vlasenko
vda.linux at googlemail.com
Thu Apr 30 15:30:02 UTC 2020
commit: https://git.busybox.net/busybox/commit/?id=9f3b410006956c59896034bb790b20e655f8b4cb
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
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>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.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 a11b1d67d..2a4c839a7 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -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
diff --git a/shell/hush.c b/shell/hush.c
index 0a92f5da7..cab7ea5b0 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -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
More information about the busybox-cvs
mailing list