about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-09-24 10:00:54 +1200
committerNick Cameron <ncameron@mozilla.com>2015-09-24 10:00:54 +1200
commit8f51c8d687cb6fd7e98f68b93f40445ecd4690fa (patch)
treefee062e380e807b431755b73ba78d8128683f906 /src/liballoc/heap.rs
parentafae2ff723393b3ab4ccffef6ac7c6d1809e2da0 (diff)
downloadrust-8f51c8d687cb6fd7e98f68b93f40445ecd4690fa.tar.gz
rust-8f51c8d687cb6fd7e98f68b93f40445ecd4690fa.zip
rustfmt liballoc
Diffstat (limited to 'src/liballoc/heap.rs')
-rw-r--r--src/liballoc/heap.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 10cb84d1da1..de934807e18 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -22,10 +22,12 @@ extern {
     #[allocator]
     fn __rust_allocate(size: usize, align: usize) -> *mut u8;
     fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize);
-    fn __rust_reallocate(ptr: *mut u8, old_size: usize, size: usize,
-                         align: usize) -> *mut u8;
-    fn __rust_reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
-                               align: usize) -> usize;
+    fn __rust_reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8;
+    fn __rust_reallocate_inplace(ptr: *mut u8,
+                                 old_size: usize,
+                                 size: usize,
+                                 align: usize)
+                                 -> usize;
     fn __rust_usable_size(size: usize, align: usize) -> usize;
 }
 
@@ -84,8 +86,11 @@ pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usiz
 /// create the allocation referenced by `ptr`. The `old_size` parameter may be
 /// any value in range_inclusive(requested_size, usable_size).
 #[inline]
-pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
-                                 align: usize) -> usize {
+pub unsafe fn reallocate_inplace(ptr: *mut u8,
+                                 old_size: usize,
+                                 size: usize,
+                                 align: usize)
+                                 -> usize {
     check_size_and_alignment(size, align);
     __rust_reallocate_inplace(ptr, old_size, size, align)
 }
@@ -124,7 +129,9 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
         EMPTY as *mut u8
     } else {
         let ptr = allocate(size, align);
-        if ptr.is_null() { ::oom() }
+        if ptr.is_null() {
+            ::oom()
+        }
         ptr
     }
 }
@@ -148,7 +155,9 @@ mod tests {
         unsafe {
             let size = 4000;
             let ptr = heap::allocate(size, 8);
-            if ptr.is_null() { ::oom() }
+            if ptr.is_null() {
+                ::oom()
+            }
             let ret = heap::reallocate_inplace(ptr, size, size, 8);
             heap::deallocate(ptr, size, 8);
             assert_eq!(ret, heap::usable_size(size, 8));