diff src/alloc.c @ 88123:375f2633d815

New directory
author Kenichi Handa <handa@m17n.org>
date Mon, 08 Sep 2003 11:56:09 +0000
parents 695cf19ef79e
children 2f877ed80fa6
line wrap: on
line diff
--- a/src/alloc.c	Thu Sep 04 04:00:49 2003 +0000
+++ b/src/alloc.c	Mon Sep 08 11:56:09 2003 +0000
@@ -552,7 +552,7 @@
 }
 
 
-/* Like free but block interrupt input.  */
+/* Like free but block interrupt input..  */
 
 void
 xfree (block)
@@ -738,8 +738,7 @@
 
   if (!free_ablock)
     {
-      int i;
-      EMACS_INT aligned; /* int gets warning casting to 64-bit pointer.  */
+      int i, aligned;
 
 #ifdef DOUG_LEA_MALLOC
       /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
@@ -767,23 +766,6 @@
       mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
 #endif
 
-      /* If the memory just allocated cannot be addressed thru a Lisp
-	 object's pointer, and it needs to be, that's equivalent to
-	 running out of memory.  */
-      if (type != MEM_TYPE_NON_LISP)
-	{
-	  Lisp_Object tem;
-	  char *end = (char *) base + ABLOCKS_BYTES - 1;
-	  XSETCONS (tem, end);
-	  if ((char *) XCONS (tem) != end)
-	    {
-	      lisp_malloc_loser = base;
-	      free (base);
-	      UNBLOCK_INPUT;
-	      memory_full ();
-	    }
-	}
-
       /* Initialize the blocks and put them on the free list.
 	 Is `base' was not properly aligned, we can't use the last block.  */
       for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++)
@@ -806,6 +788,21 @@
   val = free_ablock;
   free_ablock = free_ablock->x.next_free;
 
+  /* If the memory just allocated cannot be addressed thru a Lisp
+     object's pointer, and it needs to be,
+     that's equivalent to running out of memory.  */
+  if (val && type != MEM_TYPE_NON_LISP)
+    {
+      Lisp_Object tem;
+      XSETCONS (tem, (char *) val + nbytes - 1);
+      if ((char *) XCONS (tem) != (char *) val + nbytes - 1)
+	{
+	  lisp_malloc_loser = val;
+	  free (val);
+	  val = 0;
+	}
+    }
+
 #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
   if (val && type != MEM_TYPE_NON_LISP)
     mem_insert (val, (char *) val + nbytes, type);
@@ -5027,7 +5024,6 @@
 	     since all markable slots in current buffer marked anyway.  */
 	  /* Don't need to do Lisp_Objfwd, since the places they point
 	     are protected with staticpro.  */
-	case Lisp_Misc_Save_Value:
 	  break;
 
 	case Lisp_Misc_Overlay:
@@ -5789,6 +5785,3 @@
   defsubr (&Sgc_status);
 #endif
 }
-
-/* arch-tag: 6695ca10-e3c5-4c2c-8bc3-ed26a7dda857
-   (do not change this comment) */