From b726ead94e911e1ce3e8b582c315b3d6f83a6eb7 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 10 Sep 2006 15:24:26 +0000 Subject: 22676, 22678: extend sched and make it able to run events when waiting for input --- Src/subst.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'Src/subst.c') 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) { -- cgit 1.4.1