summaryrefslogtreecommitdiff
path: root/Src/zsh_system.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/zsh_system.h')
-rw-r--r--Src/zsh_system.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index e68fd62f9..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 */
@@ -708,7 +712,10 @@ struct timezone {
#endif
#ifndef HAVE_MEMMOVE
-# define memmove(dest, src, len) bcopy((src), (dest), (len))
+# ifndef memmove
+static char *zmmv;
+# define memmove(dest, src, len) (bcopy((src), zmmv = (dest), (len)), zmmv)
+# endif
#endif
#ifndef offsetof
@@ -874,3 +881,8 @@ extern short ospeed;
# endif
# endif
#endif
+
+#ifdef ZSH_VALGRIND
+# include "valgrind/valgrind.h"
+# include "valgrind/memcheck.h"
+#endif