diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-08 20:26:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-08 20:26:11 +0100 |
commit | 6c635d62d41477e92f0b30b0f525c7838e64a07d (patch) | |
tree | e7a4c92cd3c376baca692818bdf3e6d93907c0b1 | |
parent | 5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9 (diff) | |
download | busybox-w32-6c635d62d41477e92f0b30b0f525c7838e64a07d.tar.gz busybox-w32-6c635d62d41477e92f0b30b0f525c7838e64a07d.tar.bz2 busybox-w32-6c635d62d41477e92f0b30b0f525c7838e64a07d.zip |
hush: small optimization in run_list
I thought gcc can detect this itself. It doesn't.
function old new delta
run_list 1030 1021 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/shell/hush.c b/shell/hush.c index a5f059924..5a36a7692 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -8004,20 +8004,21 @@ static int run_list(struct pipe *pi) | |||
8004 | G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid; | 8004 | G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid; |
8005 | debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n"); | 8005 | debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n"); |
8006 | /* Check pi->pi_inverted? "! sleep 1 & echo $?": bash says 1. dash and ash says 0 */ | 8006 | /* Check pi->pi_inverted? "! sleep 1 & echo $?": bash says 1. dash and ash says 0 */ |
8007 | G.last_exitcode = rcode = EXIT_SUCCESS; | 8007 | rcode = EXIT_SUCCESS; |
8008 | check_and_run_traps(); | 8008 | goto check_traps; |
8009 | } else { | 8009 | } else { |
8010 | #if ENABLE_HUSH_JOB | 8010 | #if ENABLE_HUSH_JOB |
8011 | if (G.run_list_level == 1 && G_interactive_fd) { | 8011 | if (G.run_list_level == 1 && G_interactive_fd) { |
8012 | /* Waits for completion, then fg's main shell */ | 8012 | /* Waits for completion, then fg's main shell */ |
8013 | rcode = checkjobs_and_fg_shell(pi); | 8013 | rcode = checkjobs_and_fg_shell(pi); |
8014 | debug_printf_exec(": checkjobs_and_fg_shell exitcode %d\n", rcode); | 8014 | debug_printf_exec(": checkjobs_and_fg_shell exitcode %d\n", rcode); |
8015 | } else | 8015 | goto check_traps; |
8016 | #endif | ||
8017 | { /* This one just waits for completion */ | ||
8018 | rcode = checkjobs(pi, 0 /*(no pid to wait for)*/); | ||
8019 | debug_printf_exec(": checkjobs exitcode %d\n", rcode); | ||
8020 | } | 8016 | } |
8017 | #endif | ||
8018 | /* This one just waits for completion */ | ||
8019 | rcode = checkjobs(pi, 0 /*(no pid to wait for)*/); | ||
8020 | debug_printf_exec(": checkjobs exitcode %d\n", rcode); | ||
8021 | check_traps: | ||
8021 | G.last_exitcode = rcode; | 8022 | G.last_exitcode = rcode; |
8022 | check_and_run_traps(); | 8023 | check_and_run_traps(); |
8023 | } | 8024 | } |