Skip to content

Commit

Permalink
refactor(pal/hermit): use default impl of GlobalAlloc::alloc_zeroed
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
  • Loading branch information
mkroening committed Jul 31, 2024
1 parent c337019 commit 8b7f4ee
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions std/src/sys/pal/hermit/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ unsafe impl GlobalAlloc for System {
hermit_abi::malloc(layout.size(), layout.align())
}

unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
let addr = hermit_abi::malloc(layout.size(), layout.align());

if !addr.is_null() {
ptr::write_bytes(addr, 0x00, layout.size());
}

addr
}

#[inline]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
hermit_abi::free(ptr, layout.size(), layout.align())
Expand Down

0 comments on commit 8b7f4ee

Please sign in to comment.