about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-09-10 15:24:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-09-10 15:24:26 +0000
commitb726ead94e911e1ce3e8b582c315b3d6f83a6eb7 (patch)
tree6298d1215ba8a55aa8cac4fd536de3af91bbb4b2 /Src/subst.c
parent638b0da9704add12fff91868efdfbb2dd35f0b54 (diff)
downloadzsh-b726ead94e911e1ce3e8b582c315b3d6f83a6eb7.tar.gz
zsh-b726ead94e911e1ce3e8b582c315b3d6f83a6eb7.tar.xz
zsh-b726ead94e911e1ce3e8b582c315b3d6f83a6eb7.zip
22676, 22678: extend sched and make it able to run events when waiting for
input
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 9f2703326..67afd0f03 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -70,9 +70,24 @@ prefork(LinkList list, int flags)
 		return;
 	    }
 	} else {
-	    if (isset(SHFILEEXPANSION))
-		filesub((char **)getaddrdata(node),
-			flags & (PF_TYPESET|PF_ASSIGN));
+	    if (isset(SHFILEEXPANSION)) {
+		/*
+		 * Here and below we avoid taking the address
+		 * of a void * and then pretending it's a char **
+		 * instead of a void ** by a little inefficiency.
+		 * This could be avoided with some extra linked list
+		 * machinery, but that would need quite a lot of work
+		 * to ensure consistency.  What we really need is
+		 * templates...
+		 */
+		char *cptr = (char *)getdata(node);
+		filesub(&cptr, flags & (PF_TYPESET|PF_ASSIGN));
+		/*
+		 * The assignment is so simple it's not worth
+		 * testing if cptr changed...
+		 */
+		setdata(node, cptr);
+	    }
 	    if (!(node = stringsubst(list, node, flags & PF_SINGLE, asssub))) {
 		unqueue_signals();
 		return;
@@ -92,9 +107,11 @@ prefork(LinkList list, int flags)
 		    xpandbraces(list, &node);
 		}
 	    }
-	    if (unset(SHFILEEXPANSION))
-		filesub((char **)getaddrdata(node),
-			flags & (PF_TYPESET|PF_ASSIGN));
+	    if (unset(SHFILEEXPANSION)) {
+		char *cptr = (char *)getdata(node);
+		filesub(&cptr, flags & (PF_TYPESET|PF_ASSIGN));
+		setdata(node, cptr);
+	    }
 	} else if (!(flags & PF_SINGLE) && !keep)
 	    uremnode(list, node);
 	if (errflag) {