diff options
| author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-03-07 12:58:40 +0000 |
|---|---|---|
| committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-03-07 12:58:40 +0000 |
| commit | 33ec971c33714ff469a481d1409aa9330e043224 (patch) | |
| tree | 182f1ecce434561b5f12ef6eb8e7dde52bebd282 /Src/mem.c | |
| parent | unposted: support build with GCC on ReliantUNIX (diff) | |
| download | zsh-33ec971c33714ff469a481d1409aa9330e043224.tar zsh-33ec971c33714ff469a481d1409aa9330e043224.tar.gz zsh-33ec971c33714ff469a481d1409aa9330e043224.tar.bz2 zsh-33ec971c33714ff469a481d1409aa9330e043224.tar.lz zsh-33ec971c33714ff469a481d1409aa9330e043224.tar.xz zsh-33ec971c33714ff469a481d1409aa9330e043224.tar.zst zsh-33ec971c33714ff469a481d1409aa9330e043224.zip | |
two optimisations
Diffstat (limited to 'Src/mem.c')
| -rw-r--r-- | Src/mem.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -105,7 +105,8 @@ union mem_align { static Heap heaps; -/* first heap with free space, not always correct */ +/* a heap with free space, not always correct (it will be the last heap + * if that was newly allocated but it may also be another one) */ static Heap fheap; @@ -297,7 +298,8 @@ zhalloc(size_t size) /* find a heap with enough free space */ - for (h = (fheap ? fheap : heaps); h; h = h->next) { + for (h = ((fheap && HEAP_ARENA_SIZE >= (size + fheap->used)) ? fheap : heaps); + h; h = h->next) { if (HEAP_ARENA_SIZE >= (n = size + h->used)) { void *ret; @@ -364,7 +366,7 @@ zhalloc(size_t size) hp->next = h; else heaps = h; - fheap = NULL; + fheap = h; unqueue_signals(); return arena(h); |
