about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c12
-rw-r--r--Src/parse.c2
2 files changed, 4 insertions, 10 deletions
diff --git a/Src/exec.c b/Src/exec.c
index df42bad32..f242ab7aa 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3413,15 +3413,9 @@ stripkshdef(Eprog prog, char *name)
 	return NULL;
     code = *pc++;
     if (wc_code(code) != WC_LIST ||
-	(WC_LIST_TYPE(code) & (Z_SYNC|Z_END)) != (Z_SYNC|Z_END))
-	return prog;
-    code = *pc++;
-    if (wc_code(code) != WC_SUBLIST ||
-	WC_SUBLIST_FLAGS(code) || WC_SUBLIST_TYPE(code) != WC_SUBLIST_END)
-	return prog;
-    code = *pc++;
-    if (wc_code(code) != WC_PIPE || WC_PIPE_TYPE(code) != WC_PIPE_END)
+	(WC_LIST_TYPE(code) & (Z_SYNC|Z_END|Z_SIMPLE)) != (Z_SYNC|Z_END|Z_SIMPLE))
 	return prog;
+    pc++;
     code = *pc++;
     if (wc_code(code) != WC_FUNCDEF ||
 	*pc != 1 || strcmp(name, ecrawstr(prog, pc + 1, NULL)))
@@ -3450,6 +3444,7 @@ stripkshdef(Eprog prog, char *name)
 	    ret->alloc = EA_HEAP;
 	    ret->pats = pp = (Patprog *) zhalloc(len);
 	    ret->prog = (Wordcode) (ret->pats + npats);
+	    ret->strs = (char *) (ret->prog + nprg);
 	    memcpy(ret->prog, pc, plen);
 	    memcpy(ret->strs, prog->strs + sbeg, nstrs);
 	    ret->dump = NULL;
@@ -3458,7 +3453,6 @@ stripkshdef(Eprog prog, char *name)
 	ret->npats = npats;
 	for (i = npats; i--; pp++)
 	    *pp = dummy_patprog1;
-	ret->strs = (char *) (ret->prog + nprg);
 	ret->shf = NULL;
 
 	return ret;
diff --git a/Src/parse.c b/Src/parse.c
index 0b11668c2..fb20944c2 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2619,7 +2619,7 @@ try_dump_file(char *dump, char *name, char *func)
 
 	    prog = (Eprog) zalloc(sizeof(*prog));
 
-	    prog->alloc = EA_MAP;
+	    prog->alloc = EA_REAL;
 	    prog->len = h->len + po;
 	    prog->npats = np = h->npats;
 	    prog->pats = pp = (Patprog *) d;