From 2b91958dff0b7bae83cf2c3f2db55bd248fe0956 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 8 Apr 2016 11:57:20 +0100 Subject: Rewrite iteration through applet names to save a few bytes function old new delta run_applet_and_exit 758 755 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3) Total: -3 bytes In standalone shell mode the saving increases to 17 bytes. Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libbb/lineedit.c') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 2ddb2b6e9..3e62f46b4 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -779,12 +779,11 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) if (type == FIND_EXE_ONLY) { const char *p = applet_names; - i = 0; - while (i < NUM_APPLETS) { + while (*p) { if (strncmp(pfind, p, pf_len) == 0) add_match(xstrdup(p)); - p += strlen(p) + 1; - i++; + while (*p++ != '\0') + continue; } } #endif -- cgit v1.2.3