aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-04-08 11:57:20 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-15 22:13:51 +0200
commit2b91958dff0b7bae83cf2c3f2db55bd248fe0956 (patch)
tree3b31eba78e93613ea307dde0fbd8995d47c15500
parente4d925b8899e38437311d2c63d0d0d200e04b5a1 (diff)
downloadbusybox-w32-2b91958dff0b7bae83cf2c3f2db55bd248fe0956.tar.gz
busybox-w32-2b91958dff0b7bae83cf2c3f2db55bd248fe0956.tar.bz2
busybox-w32-2b91958dff0b7bae83cf2c3f2db55bd248fe0956.zip
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 <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/appletlib.c3
-rw-r--r--libbb/lineedit.c7
-rw-r--r--shell/ash.c3
3 files changed, 7 insertions, 6 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index de654f64c..b682e6b85 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -791,7 +791,8 @@ static int busybox_main(char **argv)
791 full_write2_str(a); 791 full_write2_str(a);
792 full_write2_str("\n"); 792 full_write2_str("\n");
793 i++; 793 i++;
794 a += strlen(a) + 1; 794 while (*a++ != '\0')
795 continue;
795 } 796 }
796 return 0; 797 return 0;
797 } 798 }
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)
779 if (type == FIND_EXE_ONLY) { 779 if (type == FIND_EXE_ONLY) {
780 const char *p = applet_names; 780 const char *p = applet_names;
781 781
782 i = 0; 782 while (*p) {
783 while (i < NUM_APPLETS) {
784 if (strncmp(pfind, p, pf_len) == 0) 783 if (strncmp(pfind, p, pf_len) == 0)
785 add_match(xstrdup(p)); 784 add_match(xstrdup(p));
786 p += strlen(p) + 1; 785 while (*p++ != '\0')
787 i++; 786 continue;
788 } 787 }
789 } 788 }
790#endif 789#endif
diff --git a/shell/ash.c b/shell/ash.c
index 5613e1f33..13eeab34b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12597,7 +12597,8 @@ helpcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12597 out1fmt("\n"); 12597 out1fmt("\n");
12598 col = 0; 12598 col = 0;
12599 } 12599 }
12600 a += strlen(a) + 1; 12600 while (*a++ != '\0')
12601 continue;
12601 } 12602 }
12602 } 12603 }
12603# endif 12604# endif