aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-05-25 10:00:36 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-05-25 10:00:36 +0000
commit0be346a3ab77c434d0d915368ba73ce466cbd293 (patch)
tree0a53323c3f8927144f036d0709eb2b6b1b97feb7
parent1e83fbc474caf0e566a06b849107942961c4b846 (diff)
downloadbusybox-w32-0be346a3ab77c434d0d915368ba73ce466cbd293.tar.gz
busybox-w32-0be346a3ab77c434d0d915368ba73ce466cbd293.tar.bz2
busybox-w32-0be346a3ab77c434d0d915368ba73ce466cbd293.zip
hush: micro-optimization in new variable code
git-svn-id: svn://busybox.net/trunk/busybox@18689 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--shell/hush.c10
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;