Skip to content

Commit d7a7401

Browse files
committed
Fix test errors
1 parent a9e2541 commit d7a7401

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

mallockit/src/malloc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<P: Plan> MallocAPI<P> {
5454
pub unsafe fn malloc_size(&self, ptr: Address) -> usize {
5555
let ptr = Address::from(ptr);
5656
#[cfg(target_os = "macos")]
57-
if Self::is_in_mallockit_heap(ptr.into()) {
57+
if !Self::is_in_mallockit_heap(ptr.into()) {
5858
return crate::util::macos_malloc_zone::external_memory_size(ptr);
5959
}
6060
P::get_layout(ptr).size()
@@ -85,7 +85,7 @@ impl<P: Plan> MallocAPI<P> {
8585
return;
8686
}
8787
#[cfg(target_os = "macos")]
88-
if Self::is_in_mallockit_heap(ptr.into()) {
88+
if !Self::is_in_mallockit_heap(ptr.into()) {
8989
return;
9090
}
9191
self.mutator().dealloc(ptr.into());
@@ -108,7 +108,7 @@ impl<P: Plan> MallocAPI<P> {
108108
let new_size = Self::align_up(new_size, Self::MIN_ALIGNMENT);
109109

110110
#[cfg(target_os = "macos")]
111-
if Self::is_in_mallockit_heap(ptr.into()) {
111+
if !Self::is_in_mallockit_heap(ptr.into()) {
112112
let ptr = Address::from(ptr);
113113
let old_size = crate::util::macos_malloc_zone::external_memory_size(ptr);
114114
let new_layout =

mallockit/src/mutator.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ pub trait TLS: Sized {
9191
}
9292
}
9393

94+
impl TLS for u8 {
95+
const NEW: Self = 0;
96+
}
97+
9498
#[cfg(target_os = "macos")]
9599
mod macos_tls {
96100
use spin::{mutex::Mutex, Yield};
@@ -111,9 +115,6 @@ mod macos_tls {
111115
#[cfg(test)]
112116
#[no_mangle]
113117
extern "C" fn mallockit_initialize_macos_tls() -> *mut u8 {
114-
impl TLS for u8 {
115-
const NEW: Self = 0;
116-
}
117118
get_tls::<u8>()
118119
}
119120

0 commit comments

Comments
 (0)