about summary refs log tree commit diff
path: root/Src/zsh_system.h
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-07-24 08:45:16 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-07-24 08:45:16 -0700
commit2f0efe9f592255d0d83c0929423cc397bb1ebfa4 (patch)
tree822e7444d47471c8eafe0b27e2150822b72ac9ec /Src/zsh_system.h
parent77119afe19a781251e77a369db1dc9c8556055a0 (diff)
downloadzsh-2f0efe9f592255d0d83c0929423cc397bb1ebfa4.tar.gz
zsh-2f0efe9f592255d0d83c0929423cc397bb1ebfa4.tar.xz
zsh-2f0efe9f592255d0d83c0929423cc397bb1ebfa4.zip
32853: redefine VARARR() to use heap rather than stack allocation
enable old behavior via "configure --with-stack-allocation"
Diffstat (limited to 'Src/zsh_system.h')
-rw-r--r--Src/zsh_system.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 601de69f6..811340d42 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -286,11 +286,15 @@ struct timezone {
 # include <limits.h>
 #endif
 
+#ifdef USE_STACK_ALLOCATION
 #ifdef HAVE_VARIABLE_LENGTH_ARRAYS
 # define VARARR(X,Y,Z)	X (Y)[Z]
 #else
 # define VARARR(X,Y,Z)	X *(Y) = (X *) alloca(sizeof(X) * (Z))
 #endif
+#else
+# define VARARR(X,Y,Z)	X *(Y) = (X *) zhalloc(sizeof(X) * (Z))
+#endif
 
 /* we should handle unlimited sizes from pathconf(_PC_PATH_MAX) */
 /* but this is too much trouble                                 */