diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-25 10:00:36 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-25 10:00:36 +0000 |
commit | 201c72a8d672c1e2985bd340f6fa527251d695ba (patch) | |
tree | 0a53323c3f8927144f036d0709eb2b6b1b97feb7 /shell/hush.c | |
parent | 28c0f0f4fe120417b0d618690f74029004ad474c (diff) | |
download | busybox-w32-201c72a8d672c1e2985bd340f6fa527251d695ba.tar.gz busybox-w32-201c72a8d672c1e2985bd340f6fa527251d695ba.tar.bz2 busybox-w32-201c72a8d672c1e2985bd340f6fa527251d695ba.zip |
hush: micro-optimization in new variable code
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c index f40284cbb..1c7cddd36 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2703,12 +2703,13 @@ static int set_local_var(char *str, int flg_export) | |||
2703 | return -1; | 2703 | return -1; |
2704 | } | 2704 | } |
2705 | 2705 | ||
2706 | name_len = value - str; | 2706 | name_len = value - str + 1; /* including '=' */ |
2707 | cur = top_var; /* cannot be NULL (we have HUSH_VERSION and it's RO) */ | 2707 | cur = top_var; /* cannot be NULL (we have HUSH_VERSION and it's RO) */ |
2708 | while (1) { | 2708 | while (1) { |
2709 | if (strncmp(cur->varstr, str, name_len) != 0 || cur->varstr[name_len] != '=') { | 2709 | if (strncmp(cur->varstr, str, name_len) != 0) { |
2710 | if (!cur->next) { | 2710 | if (!cur->next) { |
2711 | /* cur points to last var in linked list */ | 2711 | /* Bail out. Note that now cur points |
2712 | * to last var in linked list */ | ||
2712 | break; | 2713 | break; |
2713 | } | 2714 | } |
2714 | cur = cur->next; | 2715 | cur = cur->next; |
@@ -2837,8 +2838,7 @@ static int setup_redirect(struct p_context *ctx, int fd, redir_type style, | |||
2837 | /* We do _not_ try to open the file that src points to, | 2838 | /* We do _not_ try to open the file that src points to, |
2838 | * since we need to return and let src be expanded first. | 2839 | * since we need to return and let src be expanded first. |
2839 | * Set ctx->pending_redirect, so we know what to do at the | 2840 | * Set ctx->pending_redirect, so we know what to do at the |
2840 | * end of the next parsed word. | 2841 | * end of the next parsed word. */ |
2841 | */ | ||
2842 | ctx->pending_redirect = redir; | 2842 | ctx->pending_redirect = redir; |
2843 | } | 2843 | } |
2844 | return 0; | 2844 | return 0; |