changeset 10747:c6a68e4ee53a

(r_alloc_free): Call refill_memory_reserve only if emacs. Include getpagesize.h unconditionally. (free_bloc): Don't die if bloc->next or bloc->prev is null. [!emacs] (bzero): New macro definition.
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Feb 1995 14:27:18 +0000
parents ea87e4d9c8ea
children 0bee4d7bc9a4
files src/ralloc.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ralloc.c	Tue Feb 14 14:25:36 1995 +0000
+++ b/src/ralloc.c	Tue Feb 14 14:27:18 1995 +0000
@@ -56,9 +56,7 @@
    overlap.  */
 extern void safe_bcopy ();
 
-#include "getpagesize.h"
-
-#else	/* Not emacs.  */
+#else /* not emacs */
 
 #include <stddef.h>
 
@@ -70,8 +68,11 @@
 #include <string.h>
 
 #define safe_bcopy(x, y, z) memmove (y, x, z)
+#define bzero(x, len) memset (x, 0, len)
 
-#endif	/* emacs.  */
+#endif	/* not emacs */
+
+#include "getpagesize.h"
 
 #define NIL ((POINTER) 0)
 
@@ -691,14 +692,14 @@
   /* Update the records of which blocs are in HEAP.  */
   if (heap->first_bloc == bloc)
     {
-      if (bloc->next->heap == heap)
+      if (bloc->next != 0 && bloc->next->heap == heap)
 	heap->first_bloc = bloc->next;
       else
 	heap->first_bloc = heap->last_bloc = NIL_BLOC;
     }
   if (heap->last_bloc == bloc)
     {
-      if (bloc->prev->heap == heap)
+      if (bloc->prev != 0 && bloc->prev->heap == heap)
 	heap->last_bloc = bloc->prev;
       else
 	heap->first_bloc = heap->last_bloc = NIL_BLOC;
@@ -900,7 +901,9 @@
   free_bloc (dead_bloc);
   *ptr = 0;
 
+#ifdef emacs
   refill_memory_reserve ();
+#endif
 }
 
 /* Given a pointer at address PTR to relocatable data, resize it to SIZE.