diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-03-06 17:21:57 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-03-06 17:21:57 +0100 |
commit | 33f7c8f200b6c3f7163dc89723ab67462688dccd (patch) | |
tree | bc91b2c030b3bf9cd6fd22cd14c11e4238ae4929 | |
parent | d51ba0b5ab13aa09ab0482bd2dc63f39e8b40fad (diff) | |
download | busybox-w32-33f7c8f200b6c3f7163dc89723ab67462688dccd.tar.gz busybox-w32-33f7c8f200b6c3f7163dc89723ab67462688dccd.tar.bz2 busybox-w32-33f7c8f200b6c3f7163dc89723ab67462688dccd.zip |
hush: code shrink
function old new delta
run_pipe 1589 1591 +2
pseudo_exec_argv 374 375 +1
builtin_type 114 115 +1
find_function 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 4/-8) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c index 762cc3fe4..6e64efb70 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7181,21 +7181,22 @@ static const struct built_in_command *find_builtin(const char *name) | |||
7181 | #if ENABLE_HUSH_FUNCTIONS | 7181 | #if ENABLE_HUSH_FUNCTIONS |
7182 | static struct function **find_function_slot(const char *name) | 7182 | static struct function **find_function_slot(const char *name) |
7183 | { | 7183 | { |
7184 | struct function *funcp; | ||
7184 | struct function **funcpp = &G.top_func; | 7185 | struct function **funcpp = &G.top_func; |
7185 | while (*funcpp) { | 7186 | |
7186 | if (strcmp(name, (*funcpp)->name) == 0) { | 7187 | while ((funcp = *funcpp) != NULL) { |
7188 | if (strcmp(name, funcp->name) == 0) { | ||
7189 | debug_printf_exec("found function '%s'\n", name); | ||
7187 | break; | 7190 | break; |
7188 | } | 7191 | } |
7189 | funcpp = &(*funcpp)->next; | 7192 | funcpp = &funcp->next; |
7190 | } | 7193 | } |
7191 | return funcpp; | 7194 | return funcpp; |
7192 | } | 7195 | } |
7193 | 7196 | ||
7194 | static const struct function *find_function(const char *name) | 7197 | static ALWAYS_INLINE const struct function *find_function(const char *name) |
7195 | { | 7198 | { |
7196 | const struct function *funcp = *find_function_slot(name); | 7199 | const struct function *funcp = *find_function_slot(name); |
7197 | if (funcp) | ||
7198 | debug_printf_exec("found function '%s'\n", name); | ||
7199 | return funcp; | 7200 | return funcp; |
7200 | } | 7201 | } |
7201 | 7202 | ||