From d0d357edeb8527becced15e2784b92790d2b22c1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 25 Jun 2013 12:09:50 +0200 Subject: heap: Add _Heap_Greedy_allocate_all_except_largest Add rtems_workspace_greedy_allocate_all_except_largest() and rtems_heap_greedy_allocate_all_except_largest(). --- cpukit/score/src/heapgreedy.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cpukit/score/src/heapgreedy.c') diff --git a/cpukit/score/src/heapgreedy.c b/cpukit/score/src/heapgreedy.c index 23eb4cdd3a..b5c61a4e64 100644 --- a/cpukit/score/src/heapgreedy.c +++ b/cpukit/score/src/heapgreedy.c @@ -75,6 +75,19 @@ Heap_Block *_Heap_Greedy_allocate( return blocks; } +Heap_Block *_Heap_Greedy_allocate_all_except_largest( + Heap_Control *heap, + uintptr_t *allocatable_size +) +{ + Heap_Information info; + + _Heap_Get_free_information( heap, &info ); + *allocatable_size = info.largest - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS; + + return _Heap_Greedy_allocate( heap, allocatable_size, 1 ); +} + void _Heap_Greedy_free( Heap_Control *heap, Heap_Block *blocks -- cgit v1.2.3