diff options
Diffstat (limited to 'components/allocator/lib.rs')
-rw-r--r-- | components/allocator/lib.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs index e832e485575..6c248f08055 100644 --- a/components/allocator/lib.rs +++ b/components/allocator/lib.rs @@ -9,9 +9,9 @@ #[cfg(feature = "unstable")] #[global_allocator] -static ALLOC: platform::Allocator = platform::Allocator; +static ALLOC: Allocator = Allocator; -pub use platform::usable_size; +pub use platform::*; #[cfg(all(feature = "unstable", not(windows)))] @@ -25,6 +25,11 @@ mod platform { pub unsafe extern "C" fn usable_size(ptr: *const c_void) -> usize { jemallocator::usable_size(ptr) } + + /// Memory allocation APIs compatible with libc + pub mod libc_compat { + pub use super::jemallocator::ffi::{malloc, realloc, free}; + } } #[cfg(all(feature = "unstable", windows))] @@ -57,6 +62,10 @@ mod platform { pub unsafe extern "C" fn usable_size(_ptr: *const c_void) -> usize { 0 } -} - + /// Memory allocation APIs compatible with libc + pub mod libc_compat { + extern crate libc; + pub use self::libc::{malloc, realloc, free}; + } +} |