File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ const MIN_ALIGN: usize = 8;
32
32
target_arch = "powerpc64le" ) ) ) ]
33
33
const MIN_ALIGN : usize = 16 ;
34
34
35
+ const MALLOCX_ZERO : c_int = 0x40 ;
36
+
35
37
// MALLOCX_ALIGN(a) macro
36
38
fn mallocx_align ( a : usize ) -> c_int {
37
39
a. trailing_zeros ( ) as c_int
@@ -51,6 +53,12 @@ pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
51
53
unsafe { ffi:: mallocx ( size as size_t , flags) as * mut u8 }
52
54
}
53
55
56
+ #[ no_mangle]
57
+ pub extern fn __rust_allocate_zeroed ( size : usize , align : usize ) -> * mut u8 {
58
+ let flags = align_to_flags ( align) | MALLOCX_ZERO ;
59
+ unsafe { ffi:: mallocx ( size as size_t , flags) as * mut u8 }
60
+ }
61
+
54
62
#[ no_mangle]
55
63
pub extern fn __rust_reallocate ( ptr : * mut u8 ,
56
64
_old_size : usize ,
You can’t perform that action at this time.
0 commit comments