diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2011-12-14 01:30:08 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2011-12-14 01:31:10 +0100 |
commit | 3e739c6befbab45a3b6e460b5ce26ac0359155ec (patch) | |
tree | 0cc28cfd413d9f2a3c5c13da83606f2829e641ba /Src | |
parent | 00f335b142707b7f9e3531714b7a3bf5b377dcc1 (diff) | |
parent | 79f2f7fa2ce18552869afa33f1d0d42cf4191b04 (diff) | |
download | zsh-3e739c6befbab45a3b6e460b5ce26ac0359155ec.tar.gz zsh-3e739c6befbab45a3b6e460b5ce26ac0359155ec.zip |
Merge commit 'zsh-4.3.14' into debian
Diffstat (limited to 'Src')
-rw-r--r-- | Src/lex.c | 12 | ||||
-rw-r--r-- | Src/utils.c | 4 |
2 files changed, 4 insertions, 12 deletions
@@ -567,22 +567,14 @@ add(int c) { *bptr++ = c; if (bsiz == ++len) { -#if 0 - int newbsiz; - - newbsiz = bsiz * 8; - while (newbsiz < inbufct) - newbsiz *= 2; - bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); - bsiz = newbsiz; -#endif - int newbsiz = bsiz * 2; if (newbsiz > inbufct && inbufct > bsiz) newbsiz = inbufct; bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); + /* len == bsiz, so bptr is at the start of newly allocated memory */ + memset(bptr, 0, newbsiz - bsiz); bsiz = newbsiz; } } diff --git a/Src/utils.c b/Src/utils.c index 6c2ea98d5..014cb2fa2 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -3959,7 +3959,7 @@ metafy(char *buf, int len, int heap) if (imeta(*e++)) meta++; - if (meta || heap == META_DUP || heap == META_HEAPDUP) { + if (meta || heap == META_DUP || heap == META_HEAPDUP || *e != '\0') { switch (heap) { case META_REALLOC: buf = zrealloc(buf, len + meta + 1); @@ -4002,8 +4002,8 @@ metafy(char *buf, int len, int heap) meta--; } } + *e = '\0'; } - *e = '\0'; return buf; } |