$NetBSD$

--- src/util/memory.h.orig	2008-02-16 18:45:03.000000000 -0500
+++ src/util/memory.h
@@ -11,8 +11,10 @@
 /** Delay in seconds between each alloc try. */
 #define ALLOC_DELAY 3
 
-#define fmem_alloc(x) mem_alloc(x)
-#define fmem_free(x) mem_free(x)
+#include "malloca.h"
+
+#define fmem_alloc(x) safe_alloca(x)
+#define fmem_free(x) freea(x)
 
 
 /** Cygwin wants some size_t definition here... let's try to make it happy
@@ -24,6 +26,7 @@
 #include <gc.h>
 #endif
 
+
 #ifdef HAVE_MMAP
 void *mem_mmap_alloc(size_t size);
 void mem_mmap_free(void *p, size_t size);
@@ -85,24 +88,6 @@ void *mem_realloc(void *, size_t);
  * inside a function.
  * See alloca(3) manpage. */
 
-#undef fmem_alloc
-#undef fmem_free
-
-#ifdef HAVE_ALLOCA
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#define fmem_alloc(x) alloca(x)
-#define fmem_free(x)
-
-#else /* HAVE_ALLOCA */
-
-#define fmem_alloc(x) mem_alloc(x)
-#define fmem_free(x) mem_free(x)
-
-#endif /* HAVE_ALLOCA */
-
 #endif /* CONFIG_FASTMEM */
 
 #endif /* DEBUG_MEMLEAK */
