From 8b7f4ee6e3dc9de6afab59c8c352677f450f92b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 31 Jul 2024 12:56:38 +0200 Subject: [PATCH] refactor(pal/hermit): use default impl of `GlobalAlloc::alloc_zeroed` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- std/src/sys/pal/hermit/alloc.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/std/src/sys/pal/hermit/alloc.rs b/std/src/sys/pal/hermit/alloc.rs index 2cd0db909403b..5daa5f9e49ffe 100644 --- a/std/src/sys/pal/hermit/alloc.rs +++ b/std/src/sys/pal/hermit/alloc.rs @@ -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())