aboutsummaryrefslogtreecommitdiffstats
path: root/components/allocator/lib.rs
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2024-03-11 08:58:32 +0100
committerGitHub <noreply@github.com>2024-03-11 07:58:32 +0000
commit11c16adcd184dd5bc98ad946ac05e942d335f0a3 (patch)
treef03764841ec987d3cda805d2535d3f9397d6e36d /components/allocator/lib.rs
parentaf3583ade88a747232fee578f1af981064da7109 (diff)
downloadservo-11c16adcd184dd5bc98ad946ac05e942d335f0a3.tar.gz
servo-11c16adcd184dd5bc98ad946ac05e942d335f0a3.zip
Use libc::malloc_size on apple (#31602)
* Use libc::malloc_size on apple * Unify malloc_usable_size under *mut _
Diffstat (limited to 'components/allocator/lib.rs')
-rw-r--r--components/allocator/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs
index 507c0e380f6..f8faaa080e9 100644
--- a/components/allocator/lib.rs
+++ b/components/allocator/lib.rs
@@ -36,11 +36,11 @@ mod platform {
/// Get the size of a heap block.
pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize {
- #[cfg(target_os = "linux")]
- return libc::malloc_usable_size(ptr as *mut _);
+ #[cfg(target_vendor = "apple")]
+ return libc::malloc_size(ptr);
- #[cfg(not(target_os = "linux"))]
- return libc::malloc_usable_size(ptr);
+ #[cfg(not(target_vendor = "apple"))]
+ return libc::malloc_usable_size(ptr as *mut _);
}
pub mod libc_compat {