[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH] ash,hush: drop pointer check before calls to show_history
From: Ron Yorston <rmy () pobox ! com>
Date: 2019-12-16 9:31:10
Message-ID: 5df74ede.7xTKWHTPYmy8cxeA%rmy () pobox ! com
[Download RAW message or body]
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>
---
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
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic