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 | |
parent | 28c0f0f4fe120417b0d618690f74029004ad474c (diff) |
hush: micro-optimization in new variable code
Diffstat (limited to 'shell')
-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) return -1; } - name_len = value - str; + name_len = value - str + 1; /* including '=' */ cur = top_var; /* cannot be NULL (we have HUSH_VERSION and it's RO) */ while (1) { - if (strncmp(cur->varstr, str, name_len) != 0 || cur->varstr[name_len] != '=') { + if (strncmp(cur->varstr, str, name_len) != 0) { if (!cur->next) { - /* cur points to last var in linked list */ + /* Bail out. Note that now cur points + * to last var in linked list */ break; } cur = cur->next; @@ -2837,8 +2838,7 @@ static int setup_redirect(struct p_context *ctx, int fd, redir_type style, /* We do _not_ try to open the file that src points to, * since we need to return and let src be expanded first. * Set ctx->pending_redirect, so we know what to do at the - * end of the next parsed word. - */ + * end of the next parsed word. */ ctx->pending_redirect = redir; } return 0; |