From bb3dc913a27b9ae1d4f82f5c91c253686786c7d3 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 5 Jul 1988 11:50:11 +0000 Subject: [PATCH] improved; delayed frees did not work anyway --- modules/src/malloc/mal.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/modules/src/malloc/mal.c b/modules/src/malloc/mal.c index 67b5356ca..7439ef779 100644 --- a/modules/src/malloc/mal.c +++ b/modules/src/malloc/mal.c @@ -26,10 +26,9 @@ #define ILL_BREAK (char *)(-1) /* funny failure value */ #endif extern char *SBRK(); -privatedata char *freed; #ifdef STORE #define MAX_STORE 32 -private do_free(), Xfree(), sell_out(); +private do_free(), sell_out(); privatedata mallink *store[MAX_STORE]; #endif STORE @@ -40,7 +39,6 @@ malloc(n) register mallink *ml; register int min_class; - if (freed) Xfree(); if (n < MIN_SIZE) n = align(MIN_SIZE); else n = align(n); #ifdef STORE if (n <= MAX_STORE*MIN_SIZE) { @@ -141,18 +139,11 @@ malloc(n) free(addr) char *addr; -{ - if (freed) Xfree(); - freed = addr; -} - -private -Xfree() {check_mallinks("free entry");{ - register mallink *ml = mallink_of_block(freed); + register mallink *ml = mallink_of_block(addr); + #ifdef STORE - freed = 0; if (free_of(ml) || in_store(ml)) return; /* user frees free block */ if (size_of(ml) <= MAX_STORE*MIN_SIZE) { @@ -229,8 +220,6 @@ realloc(addr, n) register unsigned int size; if (n < MIN_SIZE) n = align(MIN_SIZE); else n = align(n); - if (freed && freed != addr) Xfree(); - else freed = 0; if (free_of(ml)) { unlink_free_chunk(ml); set_free(ml, 0); /* user reallocs free block */