1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr

This commit is contained in:
Gunnar Beutner 2021-05-01 21:10:08 +02:00 committed by Andreas Kling
parent 4e6f03a860
commit 6cf59b6ae9
58 changed files with 315 additions and 469 deletions

View file

@ -310,9 +310,8 @@ void MallocTracer::populate_memory_graph()
auto value = m_emulator.mmu().read32({ 0x23, mallocation.address + i * sizeof(u32) });
auto other_address = value.value();
if (!value.is_uninitialized() && m_memory_graph.contains(value.value())) {
#if REACHABLE_DEBUG
reportln("region/mallocation {:p} is reachable from other mallocation {:p}", other_address, mallocation.address);
#endif
if constexpr (REACHABLE_DEBUG)
reportln("region/mallocation {:p} is reachable from other mallocation {:p}", other_address, mallocation.address);
edges_from_mallocation.edges_from_node.append(other_address);
}
}
@ -339,9 +338,8 @@ void MallocTracer::populate_memory_graph()
auto value = region.read32(i * sizeof(u32));
auto other_address = value.value();
if (!value.is_uninitialized() && m_memory_graph.contains(value.value())) {
#if REACHABLE_DEBUG
reportln("region/mallocation {:p} is reachable from region {:p}-{:p}", other_address, region.base(), region.end() - 1);
#endif
if constexpr (REACHABLE_DEBUG)
reportln("region/mallocation {:p} is reachable from region {:p}-{:p}", other_address, region.base(), region.end() - 1);
m_memory_graph.find(other_address)->value.is_reachable = true;
reachable_mallocations.append(other_address);
}
@ -388,9 +386,8 @@ void MallocTracer::dump_leak_report()
populate_memory_graph();
#if REACHABLE_DEBUG
dump_memory_graph();
#endif
if constexpr (REACHABLE_DEBUG)
dump_memory_graph();
for_each_mallocation([&](auto& mallocation) {
if (mallocation.freed)