about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-24 18:50:50 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-06-24 18:50:50 +0100
commit920db696cb53122bec0c8a83087852e7e8c018f0 (patch)
tree36e6b31f8eea75fe72dd9132342bdfcf94338ab3 /Src/lex.c
parent0853bcfdd6a90fb4e6a9b7428d9b2a4975af717e (diff)
downloadzsh-920db696cb53122bec0c8a83087852e7e8c018f0.tar.gz
zsh-920db696cb53122bec0c8a83087852e7e8c018f0.tar.xz
zsh-920db696cb53122bec0c8a83087852e7e8c018f0.zip
32789: --enable-zsh-valgrind allows analysis of heap allocation
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/lex.c b/Src/lex.c
index d0f845020..8e9a49f3b 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -30,6 +30,8 @@
 #include "zsh.mdh"
 #include "lex.pro"
 
+#define LEX_HEAP_SIZE (32)
+
 /* tokens */
 
 /**/
@@ -721,7 +723,7 @@ gettok(void)
     /* word includes the last character read and possibly \ before ! */
     if (dbparens) {
 	len = 0;
-	bptr = tokstr = (char *) hcalloc(bsiz = 32);
+	bptr = tokstr = (char *) hcalloc(bsiz = LEX_HEAP_SIZE);
 	hungetc(c);
 	cmdpush(CS_MATH);
 	c = dquote_parse(infor ? ';' : ')', 0);
@@ -775,7 +777,7 @@ gettok(void)
 
 	if (lexflags & LEXFLAGS_COMMENTS_KEEP) {
 	    len = 0;
-	    bptr = tokstr = (char *)hcalloc(bsiz = 32);
+	    bptr = tokstr = (char *)hcalloc(bsiz = LEX_HEAP_SIZE);
 	    add(c);
 	}
 	hwend();
@@ -877,7 +879,7 @@ gettok(void)
 	    }
 	    if (incmdpos || (isset(SHGLOB) && !isset(KSHGLOB))) {
 		len = 0;
-		bptr = tokstr = (char *) hcalloc(bsiz = 32);
+		bptr = tokstr = (char *) hcalloc(bsiz = LEX_HEAP_SIZE);
 		switch (cmd_or_math(CS_MATH)) {
 		case 1:
 		    return DINPAR;
@@ -1027,7 +1029,7 @@ gettokstr(int c, int sub)
     peek = STRING;
     if (!sub) {
 	len = 0;
-	bptr = tokstr = (char *) hcalloc(bsiz = 32);
+	bptr = tokstr = (char *) hcalloc(bsiz = LEX_HEAP_SIZE);
     }
     for (;;) {
 	int act;