Skip to content

Commit

Permalink
Fix mi_usable_size gating
Browse files Browse the repository at this point in the history
mi_usable_size was gated behind the extended feature in 310ffbe#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759

but one test, `it_calculates_usable_size` was left behind in `lib.rs`.

Move it to `extended.rs` as well.

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
  • Loading branch information
michel-slm committed May 31, 2024
1 parent a9c410c commit 4b809e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 10 additions & 0 deletions libmimalloc-sys/src/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,16 @@ extern "C" {
mod tests {
use super::*;

#[test]
fn it_calculates_usable_size() {
let ptr = unsafe { mi_malloc(32) } as *mut u8;
let usable_size = unsafe { mi_usable_size(ptr as *mut c_void) };
assert!(
usable_size >= 32,
"usable_size should at least equal to the allocated size"
);
}

#[test]
fn runtime_stable_option() {
unsafe {
Expand Down
10 changes: 0 additions & 10 deletions libmimalloc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,4 @@ mod tests {
let ptr = unsafe { mi_realloc_aligned(ptr as *mut c_void, 8, 8) } as *mut u8;
unsafe { mi_free(ptr as *mut c_void) };
}

#[test]
fn it_calculates_usable_size() {
let ptr = unsafe { mi_malloc(32) } as *mut u8;
let usable_size = unsafe { mi_usable_size(ptr as *mut c_void) };
assert!(
usable_size >= 32,
"usable_size should at least equal to the allocated size"
);
}
}

0 comments on commit 4b809e2

Please sign in to comment.