Simplify
This commit is contained in:
+2
-2
@@ -423,7 +423,7 @@ static INLINE void allocator_free_all(Allocator *allocator)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize a list
|
||||
* Initialize a list, can also just be zero initialized
|
||||
*
|
||||
* @param list struct pointer with a *first and a **last member to an entry struct
|
||||
*/
|
||||
@@ -484,7 +484,7 @@ do { \
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize a list
|
||||
* Initialize a list, can also just be zero initialized
|
||||
*
|
||||
* @param list struct pointer with a *first and a *last member to an entry struct
|
||||
*/
|
||||
|
||||
+5
-3
@@ -47,7 +47,7 @@ static inline U32 lbh_offset(LAlloc *allocator, LBlockHeader *block)
|
||||
return NULL_BLOCK;
|
||||
}
|
||||
|
||||
return (U32)((uintptr_t)block - (uintptr_t)allocator->base);
|
||||
return (U32)((UMM)block - (uintptr_t)allocator->base);
|
||||
}
|
||||
|
||||
static void lmaybe_split_block(LAlloc *allocator, LBlockHeader *block, U32 size)
|
||||
@@ -98,7 +98,9 @@ static void lmerge_with_next(LAlloc *allocator, LBlockHeader *block)
|
||||
lblock_set_size(block, new_size);
|
||||
block->next = next->next;
|
||||
LBlockHeader *nextnext = lblock_from_offset(allocator, next->next);
|
||||
if (nextnext) nextnext->prev = lbh_offset(allocator, block);
|
||||
if (nextnext != NULL) {
|
||||
nextnext->prev = lbh_offset(allocator, block);
|
||||
}
|
||||
// note - caller have to adjust next_alloc on return
|
||||
}
|
||||
|
||||
@@ -131,7 +133,7 @@ void *lalloc(LAlloc *allocator, U32 size)
|
||||
}
|
||||
size = AlignUp(size, BLOCK_ALIGNMENT);
|
||||
|
||||
LBlockHeader *start = allocator->next_alloc ? allocator->next_alloc : (LBlockHeader *)allocator->base;
|
||||
LBlockHeader *start = allocator->next_alloc;
|
||||
LBlockHeader *curr = start;
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user