Skip to content

Commit ac43894

Browse files
authored
Update alloc API to latest nightly
1 parent 688bc7f commit ac43894

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
9797
})
9898
}
9999

100+
#[doc(hidden)]
101+
#[no_mangle]
102+
pub extern fn __rust_allocate_zeroed(size: usize, align: usize) -> *mut u8 {
103+
let ptr = __rust_allocate(size, align);
104+
if !ptr.is_null() {
105+
ptr::write_bytes(ptr, 0, size);
106+
}
107+
}
108+
100109
/// Rust de-allocation function (c.f. free)
101110
#[doc(hidden)]
102111
#[no_mangle]

0 commit comments

Comments
 (0)