Remove the unit from the linked-list of free units
| 279 | |
| 280 | // Remove the unit from the linked-list of free units |
| 281 | void HeapAllocator::removeFromFreeUnits(MemoryUnitHeader* unit) { |
| 282 | |
| 283 | if (unit->previousFreeUnit != nullptr) { |
| 284 | unit->previousFreeUnit->nextFreeUnit = unit->nextFreeUnit; |
| 285 | } |
| 286 | if (unit->nextFreeUnit != nullptr) { |
| 287 | unit->nextFreeUnit->previousFreeUnit = unit->previousFreeUnit; |
| 288 | } |
| 289 | if (unit == mFreeUnits) { |
| 290 | mFreeUnits = unit->nextFreeUnit; |
| 291 | } |
| 292 | unit->nextFreeUnit = nullptr; |
| 293 | unit->previousFreeUnit = nullptr; |
| 294 | } |
| 295 | |
| 296 | // Merge two contiguous memory units that are not allocated. |
| 297 | /// Memory unit 2 will be merged into memory unit 1 and memory unit 2 will be removed |
nothing calls this directly
no outgoing calls
no test coverage detected