Skip to content

Commit bc18e7f

Browse files
author
Andronik Ordian
committed
libmimalloc-sys: change ptr mutability to match the mimalloc c lib
1 parent c6bf457 commit bc18e7f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

libmimalloc-sys/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
use core::ffi::c_void;
44

55
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;
1313
}
1414

1515
#[cfg(test)]
@@ -19,19 +19,19 @@ mod tests {
1919
#[test]
2020
fn it_frees_memory_malloc() {
2121
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) };
2323
}
2424

2525
#[test]
2626
fn it_frees_memory_zalloc() {
2727
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) };
2929
}
3030

3131
#[test]
3232
fn it_frees_memory_realloc() {
3333
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) };
3636
}
3737
}

0 commit comments

Comments
 (0)