rust-libmimalloc-sys/libmimalloc-sys-fix-usable-size-gating.diff
Michel Lind 5acfab598e
Update to 0.1.38 (rhbz#2276528)
Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-05-30 23:05:23 -05:00

36 lines
1.1 KiB
Diff

--- a/src/extended.rs
+++ b/src/extended.rs
@@ -1014,6 +1014,16 @@ 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 {
assert_eq!(mi_option_get(mi_option_show_errors), 0);
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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"
- );
- }
}