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;
3232 target_arch = "powerpc64le" ) ) ) ]
3333const MIN_ALIGN : usize = 16 ;
3434
35+ const MALLOCX_ZERO : c_int = 0x40 ;
36+
3537// MALLOCX_ALIGN(a) macro
3638fn mallocx_align ( a : usize ) -> c_int {
3739 a. trailing_zeros ( ) as c_int
@@ -51,6 +53,12 @@ pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
5153 unsafe { ffi:: mallocx ( size as size_t , flags) as * mut u8 }
5254}
5355
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+
5462#[ no_mangle]
5563pub extern fn __rust_reallocate ( ptr : * mut u8 ,
5664 _old_size : usize ,
You can’t perform that action at this time.
0 commit comments