diff src/lisp.h @ 90038:3a5b83e18d41

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-66 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-642 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 27 Oct 2004 06:03:07 +0000
parents f3ec05478165 80393689541a
children e24e2e78deda
line wrap: on
line diff
--- a/src/lisp.h	Wed Oct 27 05:42:04 2004 +0000
+++ b/src/lisp.h	Wed Oct 27 06:03:07 2004 +0000
@@ -3307,7 +3307,7 @@
 extern Lisp_Object safe_alloca_unwind (Lisp_Object);
 
 #define USE_SAFE_ALLOCA			\
-  int sa_count = SPECPDL_INDEX ()
+  int sa_count = SPECPDL_INDEX (), sa_must_free = 0
 
 /* SAFE_ALLOCA allocates a simple buffer.  */
 
@@ -3318,6 +3318,7 @@
     else						  \
       {							  \
 	buf = (type) xmalloc (size);			  \
+	sa_must_free++;					  \
 	record_unwind_protect (safe_alloca_unwind,	  \
 			       make_save_value (buf, 0)); \
       }							  \
@@ -3325,10 +3326,12 @@
 
 /* SAFE_FREE frees xmalloced memory and enables GC as needed.  */
 
-#define SAFE_FREE(size)			\
+#define SAFE_FREE()			\
   do {					\
-    if ((size) >= MAX_ALLOCA)		\
+    if (sa_must_free) {			\
+      sa_must_free = 0;			\
       unbind_to (sa_count, Qnil);	\
+    }					\
   } while (0)
 
 
@@ -3345,17 +3348,11 @@
 	buf = (Lisp_Object *) xmalloc (size_);		  \
 	arg_ = make_save_value (buf, nelt);		  \
 	XSAVE_VALUE (arg_)->dogc = 1;			  \
+	sa_must_free++;					  \
 	record_unwind_protect (safe_alloca_unwind, arg_); \
       }							  \
   } while (0)
 
-#define SAFE_FREE_LISP(nelt)				\
-  do {							\
-    if (((nelt) * sizeof (Lisp_Object)) >= MAX_ALLOCA)	\
-      unbind_to (sa_count, Qnil);			\
-  } while (0)
-
-
 
 #endif /* EMACS_LISP_H */