Commit 40a76c99 authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan
Browse files

BlockAlloc.c: reuse tail_of function

parent 87e169a3
...@@ -210,6 +210,12 @@ void recordFreedBlocks(uint32_t node, uint32_t n) ...@@ -210,6 +210,12 @@ void recordFreedBlocks(uint32_t node, uint32_t n)
Allocation Allocation
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
STATIC_INLINE bdescr *
tail_of (bdescr *bd)
{
return bd + bd->blocks - 1;
}
STATIC_INLINE void STATIC_INLINE void
initGroup(bdescr *head) initGroup(bdescr *head)
{ {
...@@ -223,7 +229,7 @@ initGroup(bdescr *head) ...@@ -223,7 +229,7 @@ initGroup(bdescr *head)
// mblocks don't have bdescrs; freeing these is handled in a // mblocks don't have bdescrs; freeing these is handled in a
// different way by free_mblock_group(). // different way by free_mblock_group().
if (head->blocks > 1 && head->blocks <= BLOCKS_PER_MBLOCK) { if (head->blocks > 1 && head->blocks <= BLOCKS_PER_MBLOCK) {
bdescr *last = head + head->blocks-1; bdescr *last = tail_of(head);
last->blocks = 0; last->blocks = 0;
last->link = head; last->link = head;
} }
...@@ -285,13 +291,6 @@ free_list_insert (uint32_t node, bdescr *bd) ...@@ -285,13 +291,6 @@ free_list_insert (uint32_t node, bdescr *bd)
dbl_link_onto(bd, &free_list[node][ln]); dbl_link_onto(bd, &free_list[node][ln]);
} }
STATIC_INLINE bdescr *
tail_of (bdescr *bd)
{
return bd + bd->blocks - 1;
}
// After splitting a group, the last block of each group must have a // After splitting a group, the last block of each group must have a
// tail that points to the head block, to keep our invariants for // tail that points to the head block, to keep our invariants for
// coalescing. // coalescing.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment