Skip to content

Commit

Permalink
Merge pull request #5 from oli-obk/patch-1
Browse files Browse the repository at this point in the history
Update alloc API to latest nightly
  • Loading branch information
japaric committed Apr 29, 2017
2 parents 688bc7f + d953f72 commit e115a58
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
})
}

#[doc(hidden)]
#[no_mangle]
pub extern fn __rust_allocate_zeroed(size: usize, align: usize) -> *mut u8 {
let ptr = __rust_allocate(size, align);
if !ptr.is_null() {
unsafe {
ptr::write_bytes(ptr, 0, size);
}
}
ptr
}

/// Rust de-allocation function (c.f. free)
#[doc(hidden)]
#[no_mangle]
Expand Down

0 comments on commit e115a58

Please sign in to comment.