mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:47:45 +00:00
Userland: Replace VERIFY(is<T>) with verify_cast<T>
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can just do the cast right away with verify_cast<T>. :^)
This commit is contained in:
parent
7fef8c5648
commit
e59bf87374
10 changed files with 26 additions and 43 deletions
|
@ -63,8 +63,7 @@ void MallocTracer::target_did_malloc(Badge<Emulator>, FlatPtr address, size_t si
|
|||
return;
|
||||
auto* region = m_emulator.mmu().find_region({ 0x23, address });
|
||||
VERIFY(region);
|
||||
VERIFY(is<MmapRegion>(*region));
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
auto& mmap_region = verify_cast<MmapRegion>(*region);
|
||||
|
||||
auto* shadow_bits = mmap_region.shadow_data() + address - mmap_region.base();
|
||||
memset(shadow_bits, 0, size);
|
||||
|
@ -93,8 +92,7 @@ void MallocTracer::target_did_change_chunk_size(Badge<Emulator>, FlatPtr block,
|
|||
return;
|
||||
auto* region = m_emulator.mmu().find_region({ 0x23, block });
|
||||
VERIFY(region);
|
||||
VERIFY(is<MmapRegion>(*region));
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
auto& mmap_region = verify_cast<MmapRegion>(*region);
|
||||
update_metadata(mmap_region, chunk_size);
|
||||
}
|
||||
|
||||
|
@ -153,8 +151,7 @@ void MallocTracer::target_did_realloc(Badge<Emulator>, FlatPtr address, size_t s
|
|||
return;
|
||||
auto* region = m_emulator.mmu().find_region({ 0x23, address });
|
||||
VERIFY(region);
|
||||
VERIFY(is<MmapRegion>(*region));
|
||||
auto& mmap_region = static_cast<MmapRegion&>(*region);
|
||||
auto& mmap_region = verify_cast<MmapRegion>(*region);
|
||||
|
||||
VERIFY(mmap_region.is_malloc_block());
|
||||
|
||||
|
|
|
@ -61,8 +61,7 @@ void SoftMMU::ensure_split_at(X86::LogicalAddress address)
|
|||
|
||||
// If we get here, we know that the page exists and belongs to a region, that there is
|
||||
// a previous page, and that it belongs to the same region.
|
||||
VERIFY(is<MmapRegion>(m_page_to_region_map[page_index]));
|
||||
auto* old_region = static_cast<MmapRegion*>(m_page_to_region_map[page_index]);
|
||||
auto* old_region = verify_cast<MmapRegion>(m_page_to_region_map[page_index]);
|
||||
|
||||
//dbgln("splitting at {:p}", address.offset());
|
||||
//dbgln(" old region: {:p}-{:p}", old_region->base(), old_region->end() - 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue