From 3c93bfe162216c6d88778271ac0b6499fa2c1ee5 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 16 Dec 1999 14:04:16 +0000 Subject: zsh-workers/9079 --- Src/exec.c | 13 +++++++++++++ Src/lex.c | 13 ++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'Src') diff --git a/Src/exec.c b/Src/exec.c index c09536da9..d9b8d95ec 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2905,6 +2905,8 @@ execautofn(Cmd cmd, LinkList args, int flags) int noalias = noaliases; List l; + pushheap(); + noaliases = (shf->flags & PM_UNALIASED); l = getfpfunc(shf->nam); noaliases = noalias; @@ -2929,6 +2931,8 @@ execautofn(Cmd cmd, LinkList args, int flags) } LASTALLOC; shf->flags &= ~PM_UNDEFINED; } + popheap(); + execlist(shf->funcdef, 1, 0); return lastval; } @@ -2942,6 +2946,8 @@ loadautofn(Shfunc shf) int noalias = noaliases; List l; + pushheap(); + noaliases = (shf->flags & PM_UNALIASED); l = getfpfunc(shf->nam); noaliases = noalias; @@ -2955,6 +2961,8 @@ loadautofn(Shfunc shf) } LASTALLOC; shf->flags &= ~PM_UNDEFINED; + popheap(); + return 0; } @@ -3118,9 +3126,14 @@ getfpfunc(char *s) HEAPALLOC { r = parse_string(d, 1); } LASTALLOC; + + zfree(d, len + 1); + return r; } else close(fd); + + zfree(d, len + 1); } else { close(fd); } diff --git a/Src/lex.c b/Src/lex.c index 092d977ed..818ea9f8e 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -470,6 +470,7 @@ add(int c) { *bptr++ = c; if (bsiz == ++len) { +#if 0 int newbsiz; newbsiz = bsiz * 8; @@ -477,6 +478,12 @@ add(int c) newbsiz *= 2; bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); bsiz = newbsiz; +#endif + + int newbsiz = bsiz + 32; + + bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); + bsiz = newbsiz; } } @@ -556,7 +563,7 @@ gettok(void) /* word includes the last character read and possibly \ before ! */ if (dbparens) { len = 0; - bptr = tokstr = (char *)ncalloc(bsiz = 256); + bptr = tokstr = (char *)ncalloc(bsiz = 32); hungetc(c); cmdpush(CS_MATH); c = dquote_parse(infor ? ';' : ')', 0); @@ -671,7 +678,7 @@ gettok(void) } if (incmdpos) { len = 0; - bptr = tokstr = (char *)ncalloc(bsiz = 256); + bptr = tokstr = (char *)ncalloc(bsiz = 32); return cmd_or_math(CS_MATH) ? DINPAR : INPAR; } } else if (d == ')') @@ -818,7 +825,7 @@ gettokstr(int c, int sub) peek = STRING; if (!sub) { len = 0; - bptr = tokstr = (char *)ncalloc(bsiz = 256); + bptr = tokstr = (char *)ncalloc(bsiz = 32); } for (;;) { int act; -- cgit 1.4.1