summaryrefslogtreecommitdiff
path: root/src/ralloc.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-02-14 14:27:18 +0000
committerRichard M. Stallman <rms@gnu.org>1995-02-14 14:27:18 +0000
commit312578da084a6e8eaf3d660e6fc6b179f1d337a4 (patch)
treea0011e370e417a1e5463a7d24c85101d6710c2d8 /src/ralloc.c
parent3046b7e6d9a5073616fa249b26505d4bc600129b (diff)
downloademacs-312578da084a6e8eaf3d660e6fc6b179f1d337a4.tar.gz
(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.
Diffstat (limited to 'src/ralloc.c')
-rw-r--r--src/ralloc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index f27d0c64636..a0731eee6fc 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -56,9 +56,7 @@ typedef unsigned long SIZE;
overlap. */
extern void safe_bcopy ();
-#include "getpagesize.h"
-
-#else /* Not emacs. */
+#else /* not emacs */
#include <stddef.h>
@@ -70,8 +68,11 @@ typedef void *POINTER;
#include <string.h>
#define safe_bcopy(x, y, z) memmove (y, x, z)
+#define bzero(x, len) memset (x, 0, len)
+
+#endif /* not emacs */
-#endif /* emacs. */
+#include "getpagesize.h"
#define NIL ((POINTER) 0)
@@ -691,14 +692,14 @@ free_bloc (bloc)
/* 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 @@ r_alloc_free (ptr)
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.