refactor(pal/hermit): use default impl of GlobalAlloc::alloc_zeroed · model-checking/verify-rust-std@8b7f4ee (original) (raw)

Original file line number Diff line number Diff line change
@@ -9,16 +9,6 @@ unsafe impl GlobalAlloc for System {
9 9 hermit_abi::malloc(layout.size(), layout.align())
10 10 }
11 11
12 -unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
13 -let addr = hermit_abi::malloc(layout.size(), layout.align());
14 -
15 -if !addr.is_null() {
16 - ptr::write_bytes(addr, 0x00, layout.size());
17 -}
18 -
19 - addr
20 -}
21 -
22 12 #[inline]
23 13 unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
24 14 hermit_abi::free(ptr, layout.size(), layout.align())