3
3
use core:: ffi:: c_void;
4
4
5
5
extern "C" {
6
- pub fn mi_zalloc ( size : usize ) -> * const c_void ;
7
- pub fn mi_malloc ( size : usize ) -> * const c_void ;
8
- pub fn mi_realloc ( p : * const c_void , size : usize ) -> * const c_void ;
9
- pub fn mi_zalloc_aligned ( size : usize , alignment : usize ) -> * const c_void ;
10
- pub fn mi_malloc_aligned ( size : usize , alignment : usize ) -> * const c_void ;
11
- pub fn mi_realloc_aligned ( p : * const c_void , size : usize , alignment : usize ) -> * const c_void ;
12
- pub fn mi_free ( p : * const c_void ) -> c_void ;
6
+ pub fn mi_zalloc ( size : usize ) -> * mut c_void ;
7
+ pub fn mi_malloc ( size : usize ) -> * mut c_void ;
8
+ pub fn mi_realloc ( p : * mut c_void , size : usize ) -> * mut c_void ;
9
+ pub fn mi_zalloc_aligned ( size : usize , alignment : usize ) -> * mut c_void ;
10
+ pub fn mi_malloc_aligned ( size : usize , alignment : usize ) -> * mut c_void ;
11
+ pub fn mi_realloc_aligned ( p : * mut c_void , size : usize , alignment : usize ) -> * mut c_void ;
12
+ pub fn mi_free ( p : * mut c_void ) -> c_void ;
13
13
}
14
14
15
15
#[ cfg( test) ]
@@ -19,19 +19,19 @@ mod tests {
19
19
#[ test]
20
20
fn it_frees_memory_malloc ( ) {
21
21
let ptr = unsafe { mi_malloc_aligned ( 8 , 8 ) } as * mut u8 ;
22
- unsafe { mi_free ( ptr as * const c_void ) } ;
22
+ unsafe { mi_free ( ptr as * mut c_void ) } ;
23
23
}
24
24
25
25
#[ test]
26
26
fn it_frees_memory_zalloc ( ) {
27
27
let ptr = unsafe { mi_zalloc_aligned ( 8 , 8 ) } as * mut u8 ;
28
- unsafe { mi_free ( ptr as * const c_void ) } ;
28
+ unsafe { mi_free ( ptr as * mut c_void ) } ;
29
29
}
30
30
31
31
#[ test]
32
32
fn it_frees_memory_realloc ( ) {
33
33
let ptr = unsafe { mi_malloc_aligned ( 8 , 8 ) } as * mut u8 ;
34
- let ptr = unsafe { mi_realloc_aligned ( ptr as * const c_void , 8 , 8 ) } as * mut u8 ;
35
- unsafe { mi_free ( ptr as * const c_void ) } ;
34
+ let ptr = unsafe { mi_realloc_aligned ( ptr as * mut c_void , 8 , 8 ) } as * mut u8 ;
35
+ unsafe { mi_free ( ptr as * mut c_void ) } ;
36
36
}
37
37
}
0 commit comments