diff options
| author | Richard M. Stallman | 1995-02-14 14:27:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-14 14:27:18 +0000 |
| commit | d5179accb20bd7138cd0099ef91b7412a3efea5e (patch) | |
| tree | 11ca5e998c79bb053afcdf621a04df1f82fd47f2 /src/ralloc.c | |
| parent | 91c049d44f5d3d5aa79658a22069b5d501416fa2 (diff) | |
| download | emacs-d5179accb20bd7138cd0099ef91b7412a3efea5e.tar.gz emacs-d5179accb20bd7138cd0099ef91b7412a3efea5e.zip | |
(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.c | 15 |
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; | |||
| 56 | overlap. */ | 56 | overlap. */ |
| 57 | extern void safe_bcopy (); | 57 | extern void safe_bcopy (); |
| 58 | 58 | ||
| 59 | #include "getpagesize.h" | 59 | #else /* not emacs */ |
| 60 | |||
| 61 | #else /* Not emacs. */ | ||
| 62 | 60 | ||
| 63 | #include <stddef.h> | 61 | #include <stddef.h> |
| 64 | 62 | ||
| @@ -70,8 +68,11 @@ typedef void *POINTER; | |||
| 70 | #include <string.h> | 68 | #include <string.h> |
| 71 | 69 | ||
| 72 | #define safe_bcopy(x, y, z) memmove (y, x, z) | 70 | #define safe_bcopy(x, y, z) memmove (y, x, z) |
| 71 | #define bzero(x, len) memset (x, 0, len) | ||
| 72 | |||
| 73 | #endif /* not emacs */ | ||
| 73 | 74 | ||
| 74 | #endif /* emacs. */ | 75 | #include "getpagesize.h" |
| 75 | 76 | ||
| 76 | #define NIL ((POINTER) 0) | 77 | #define NIL ((POINTER) 0) |
| 77 | 78 | ||
| @@ -691,14 +692,14 @@ free_bloc (bloc) | |||
| 691 | /* Update the records of which blocs are in HEAP. */ | 692 | /* Update the records of which blocs are in HEAP. */ |
| 692 | if (heap->first_bloc == bloc) | 693 | if (heap->first_bloc == bloc) |
| 693 | { | 694 | { |
| 694 | if (bloc->next->heap == heap) | 695 | if (bloc->next != 0 && bloc->next->heap == heap) |
| 695 | heap->first_bloc = bloc->next; | 696 | heap->first_bloc = bloc->next; |
| 696 | else | 697 | else |
| 697 | heap->first_bloc = heap->last_bloc = NIL_BLOC; | 698 | heap->first_bloc = heap->last_bloc = NIL_BLOC; |
| 698 | } | 699 | } |
| 699 | if (heap->last_bloc == bloc) | 700 | if (heap->last_bloc == bloc) |
| 700 | { | 701 | { |
| 701 | if (bloc->prev->heap == heap) | 702 | if (bloc->prev != 0 && bloc->prev->heap == heap) |
| 702 | heap->last_bloc = bloc->prev; | 703 | heap->last_bloc = bloc->prev; |
| 703 | else | 704 | else |
| 704 | heap->first_bloc = heap->last_bloc = NIL_BLOC; | 705 | heap->first_bloc = heap->last_bloc = NIL_BLOC; |
| @@ -900,7 +901,9 @@ r_alloc_free (ptr) | |||
| 900 | free_bloc (dead_bloc); | 901 | free_bloc (dead_bloc); |
| 901 | *ptr = 0; | 902 | *ptr = 0; |
| 902 | 903 | ||
| 904 | #ifdef emacs | ||
| 903 | refill_memory_reserve (); | 905 | refill_memory_reserve (); |
| 906 | #endif | ||
| 904 | } | 907 | } |
| 905 | 908 | ||
| 906 | /* Given a pointer at address PTR to relocatable data, resize it to SIZE. | 909 | /* Given a pointer at address PTR to relocatable data, resize it to SIZE. |