diff src/alloc.c @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 2d532a89d707
children e121b013d1f0
line wrap: on
line diff
--- a/src/alloc.c	Mon Aug 13 09:50:16 2007 +0200
+++ b/src/alloc.c	Mon Aug 13 09:51:16 2007 +0200
@@ -67,7 +67,10 @@
 /* Define this to use malloc/free with no freelist for all datatypes,
    the hope being that some debugging tools may help detect
    freed memory references */
-/* #define ALLOC_NO_POOLS */
+#ifdef USE_DEBUG_MALLOC	/* Taking the above comment at face value -slb */
+#include <dmalloc.h>
+#define ALLOC_NO_POOLS
+#endif
 
 #include "puresize.h"
 
@@ -364,6 +367,10 @@
 
 /* like malloc and realloc but check for no memory left, and block input. */
 
+#ifdef xmalloc
+#undef xmalloc
+#endif
+
 void *
 xmalloc (int size)
 {
@@ -383,6 +390,10 @@
   return val;
 }
 
+#ifdef xrealloc
+#undef xrealloc
+#endif
+
 void *
 xrealloc (void *block, int size)
 {
@@ -453,6 +464,10 @@
 
 #endif
 
+#ifdef xstrdup
+#undef xstrdup
+#endif
+
 char *
 xstrdup (CONST char *str)
 {
@@ -1599,9 +1614,12 @@
       b->annotated = Vload_file_name_internal_the_purecopy;
     else if (!NILP (Vload_file_name_internal))
       {
+	struct gcpro gcpro1;
+	GCPRO1(val);		/* don't let val or b get reaped */
 	Vload_file_name_internal_the_purecopy =
 	  Fpurecopy (Ffile_name_nondirectory (Vload_file_name_internal));
 	b->annotated = Vload_file_name_internal_the_purecopy;
+	UNGCPRO;
       }
 #endif