[+] o1heapTraverseHeap
This commit is contained in:
parent
8f982a15d5
commit
299c082b73
22
o1heap.cpp
22
o1heap.cpp
@ -462,6 +462,28 @@ void o1heapFree(O1HeapInstance *const handle, void *const pointer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void o1heapTraverseHeap(const O1HeapInstance *const handle, bool(*fCallback)(void *, void *), void *pSecondArg)
|
||||||
|
{
|
||||||
|
AU_LOCK_GUARD(handle->mutex);
|
||||||
|
|
||||||
|
Fragment *const frag = (Fragment *)(void *)(((uint8_t *)handle) + INSTANCE_SIZE_PADDED);
|
||||||
|
O1HEAP_ASSERT((((size_t)frag) % O1HEAP_ALIGNMENT) == 0U);
|
||||||
|
|
||||||
|
const Fragment *curFrag = frag;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (curFrag->header.used)
|
||||||
|
{
|
||||||
|
if (!fCallback(((uint8_t *)curFrag) + O1HEAP_ALIGNMENT, pSecondArg))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (curFrag = curFrag->header.next);
|
||||||
|
}
|
||||||
|
|
||||||
bool o1heapDoInvariantsHold(const O1HeapInstance *const handle)
|
bool o1heapDoInvariantsHold(const O1HeapInstance *const handle)
|
||||||
{
|
{
|
||||||
O1HEAP_ASSERT(handle != NULL);
|
O1HEAP_ASSERT(handle != NULL);
|
||||||
|
@ -146,3 +146,6 @@ bool o1heapDoInvariantsHold(const O1HeapInstance *const handle);
|
|||||||
/// If the handle pointer is NULL, the behavior is undefined.
|
/// If the handle pointer is NULL, the behavior is undefined.
|
||||||
O1HeapDiagnostics o1heapGetDiagnostics(const O1HeapInstance *const handle);
|
O1HeapDiagnostics o1heapGetDiagnostics(const O1HeapInstance *const handle);
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
void o1heapTraverseHeap(const O1HeapInstance *const handle, bool(*fCallback)(void *, void *), void *pSecondArg);
|
Loading…
Reference in New Issue
Block a user