mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
refactor(pal/hermit): use default impl of GlobalAlloc::alloc_zeroed
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
This commit is contained in:
@@ -9,16 +9,6 @@ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
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())
|
||||
|
||||
Reference in New Issue
Block a user