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