Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: stripkshdef()
- X-seq: zsh-workers 9948
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: stripkshdef()
- Date: Wed, 1 Mar 2000 11:31:36 +0100 (MET)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
This is only partly a follow-up to 9947... stripkshdef() was broken
after the optimisation test that made some lists and sublists be
simplified.
And then there was a thinko in the code for reading a function from a
wordcode file.
Bye
Sven
diff -ru ../z.old/Src/exec.c Src/exec.c
--- ../z.old/Src/exec.c Wed Mar 1 11:06:38 2000
+++ Src/exec.c Wed Mar 1 11:27:13 2000
@@ -3413,15 +3413,9 @@
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 @@
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 @@
ret->npats = npats;
for (i = npats; i--; pp++)
*pp = dummy_patprog1;
- ret->strs = (char *) (ret->prog + nprg);
ret->shf = NULL;
return ret;
diff -ru ../z.old/Src/parse.c Src/parse.c
--- ../z.old/Src/parse.c Wed Mar 1 11:06:40 2000
+++ Src/parse.c Wed Mar 1 11:27:31 2000
@@ -2619,7 +2619,7 @@
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;
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author