summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2017-02-10 00:19:37 (EST)
committer P. J. McDermott <pj@pehjota.net>2017-02-10 00:19:37 (EST)
commit59b0da15168647cb91efd5ff11f0b5af6739148d (patch)
tree216ba9d022fee500a180604d7083176cce6f735d
parent9cb34d976752cd31e741eb7839b020d7221ba8a6 (diff)
downloadeggshell-59b0da15168647cb91efd5ff11f0b5af6739148d.zip
eggshell-59b0da15168647cb91efd5ff11f0b5af6739148d.tar.gz
eggshell-59b0da15168647cb91efd5ff11f0b5af6739148d.tar.bz2
research/heap.txt: Improve malloc() code
-rw-r--r--research/heap.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/research/heap.txt b/research/heap.txt
index 4ec78f1..53b6250 100644
--- a/research/heap.txt
+++ b/research/heap.txt
@@ -20,11 +20,11 @@ Functions
return ++heap->top
else
block = heap->free_head
- if heap->free_head->next_free set
- heap->free_head = heap->free_head->next_free
- else
+ if heap->free_head == heap->free_tail
unset heap->free_head
unset heap->free_tail
+ else
+ heap->free_head = heap->free_head->next_free
return block
free(heap, ptr)
if heap->free_tail unset