svn commit: trunk/busybox/shell
vda at busybox.net
vda at busybox.net
Fri May 25 10:00:38 UTC 2007
Author: vda
Date: 2007-05-25 03:00:36 -0700 (Fri, 25 May 2007)
New Revision: 18689
Log:
hush: micro-optimization in new variable code
Modified:
trunk/busybox/shell/hush.c
Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c 2007-05-25 02:46:01 UTC (rev 18688)
+++ trunk/busybox/shell/hush.c 2007-05-25 10:00:36 UTC (rev 18689)
@@ -2703,12 +2703,13 @@
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 @@
/* 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;
More information about the busybox-cvs
mailing list