aboutsummaryrefslogtreecommitdiffstats
path: root/components/allocator/lib.rs
diff options
context:
space:
mode:
authorkingdido999 <kingdido999@gmail.com>2018-08-16 15:44:54 +0800
committerkingdido999 <kingdido999@gmail.com>2018-08-16 15:44:54 +0800
commitb25a01f492a41fa86d736e46f857a94c2f606bd2 (patch)
tree945c6056980b301ace613924005fd17e7464654e /components/allocator/lib.rs
parent89ab110357cae21043f8f70f01ddf8f72c18f863 (diff)
downloadservo-b25a01f492a41fa86d736e46f857a94c2f606bd2.tar.gz
servo-b25a01f492a41fa86d736e46f857a94c2f606bd2.zip
Format component allocator #21373
Diffstat (limited to 'components/allocator/lib.rs')
-rw-r--r--components/allocator/lib.rs42
1 files changed, 25 insertions, 17 deletions
diff --git a/components/allocator/lib.rs b/components/allocator/lib.rs
index 135bfd90edd..67614892614 100644
--- a/components/allocator/lib.rs
+++ b/components/allocator/lib.rs
@@ -9,7 +9,6 @@ static ALLOC: Allocator = Allocator;
pub use platform::*;
-
#[cfg(not(windows))]
mod platform {
extern crate jemalloc_sys as ffi;
@@ -31,19 +30,31 @@ mod platform {
// The minimum alignment guaranteed by the architecture. This value is used to
// add fast paths for low alignment values.
- #[cfg(all(any(target_arch = "arm",
- target_arch = "mips",
- target_arch = "mipsel",
- target_arch = "powerpc")))]
+ #[cfg(
+ all(
+ any(
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mipsel",
+ target_arch = "powerpc"
+ )
+ )
+ )]
const MIN_ALIGN: usize = 8;
- #[cfg(all(any(target_arch = "x86",
- target_arch = "x86_64",
- target_arch = "aarch64",
- target_arch = "powerpc64",
- target_arch = "powerpc64le",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64")))]
+ #[cfg(
+ all(
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "aarch64",
+ target_arch = "powerpc64",
+ target_arch = "powerpc64le",
+ target_arch = "mips64",
+ target_arch = "s390x",
+ target_arch = "sparc64"
+ )
+ )
+ )]
const MIN_ALIGN: usize = 16;
fn layout_to_flags(align: usize, size: usize) -> c_int {
@@ -84,10 +95,7 @@ mod platform {
}
#[inline]
- unsafe fn realloc(&self,
- ptr: *mut u8,
- layout: Layout,
- new_size: usize) -> *mut u8 {
+ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
let flags = layout_to_flags(layout.align(), new_size);
ffi::rallocx(ptr as *mut _, new_size, flags) as *mut u8
}