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 @@ -33,6 +33,8 @@ const MIN_ALIGN: usize = 8;
33
33
target_arch = "powerpc64le" ) ) ) ]
34
34
const MIN_ALIGN : usize = 16 ;
35
35
36
+ const MALLOCX_ZERO : c_int = 0x40 ;
37
+
36
38
// MALLOCX_ALIGN(a) macro
37
39
fn mallocx_align ( a : usize ) -> c_int {
38
40
a. trailing_zeros ( ) as c_int
@@ -52,6 +54,12 @@ pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
52
54
unsafe { ffi:: mallocx ( size as size_t , flags) as * mut u8 }
53
55
}
54
56
57
+ #[ no_mangle]
58
+ pub extern "C" fn __rust_allocate_zeroed ( size : usize , align : usize ) -> * mut u8 {
59
+ let flags = align_to_flags ( align) | MALLOCX_ZERO ;
60
+ unsafe { ffi:: mallocx ( size as size_t , flags) as * mut u8 }
61
+ }
62
+
55
63
#[ no_mangle]
56
64
pub extern "C" fn __rust_reallocate ( ptr : * mut u8 ,
57
65
_old_size : usize ,
You can’t perform that action at this time.
0 commit comments