svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Sun Jul 29 14:05:28 UTC 2007


Author: vda
Date: 2007-07-29 07:05:27 -0700 (Sun, 29 Jul 2007)
New Revision: 19324

Log:
ash: comment non-obvious code part



Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-07-29 08:33:31 UTC (rev 19323)
+++ trunk/busybox/shell/ash.c	2007-07-29 14:05:27 UTC (rev 19324)
@@ -11121,14 +11121,16 @@
  loop:
 	while ((fullname = padvance(&path, name)) != NULL) {
 		stunalloc(fullname);
+		/* NB: code below will still use fullname
+		 * despite it being "unallocated" */
 		idx++;
 		if (pathopt) {
 			if (prefix(pathopt, "builtin")) {
 				if (bcmd)
 					goto builtin_success;
 				continue;
-			} else if (!(act & DO_NOFUNC) &&
-				   prefix(pathopt, "func")) {
+			} else if (!(act & DO_NOFUNC)
+			 && prefix(pathopt, "func")) {
 				/* handled below */
 			} else {
 				/* ignore unimplemented options */
@@ -11156,6 +11158,9 @@
 			continue;
 		if (pathopt) {          /* this is a %func directory */
 			stalloc(strlen(fullname) + 1);
+			/* NB: stalloc will return space pointed by fullname
+			 * (because we don't have any intervening allocations
+			 * between stunalloc above and this stalloc) */
 			readcmdfile(fullname);
 			cmdp = cmdlookup(name, 0);
 			if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION)




More information about the busybox-cvs mailing list