diff options
| author | bors <bors@rust-lang.org> | 2015-10-14 00:06:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-10-14 00:06:32 +0000 |
| commit | c0dc2cb81d29c051edba169f1527c149717f1c3f (patch) | |
| tree | 2c287c1f226318e52b599293464ebb4f73072d86 /src/liballoc_jemalloc | |
| parent | ec4362da562a4b591a7d120c6677e14ea713481a (diff) | |
| parent | 153754513369993ec20959c1389c25ca915cfbc3 (diff) | |
| download | rust-c0dc2cb81d29c051edba169f1527c149717f1c3f.tar.gz rust-c0dc2cb81d29c051edba169f1527c149717f1c3f.zip | |
Auto merge of #29026 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #28988, #28989, #28990, #28997, #29007, #29015 - Failed merges: #28906
Diffstat (limited to 'src/liballoc_jemalloc')
| -rw-r--r-- | src/liballoc_jemalloc/lib.rs | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 80a831fd207..f46b12e80c5 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -43,8 +43,7 @@ use libc::{c_int, c_void, size_t}; extern { fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void; fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void; - fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, - flags: c_int) -> size_t; + fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t; fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); fn je_nallocx(size: size_t, flags: c_int) -> size_t; } @@ -63,40 +62,52 @@ const MIN_ALIGN: usize = 8; const MIN_ALIGN: usize = 16; // MALLOCX_ALIGN(a) macro -fn mallocx_align(a: usize) -> c_int { a.trailing_zeros() as c_int } +fn mallocx_align(a: usize) -> c_int { + a.trailing_zeros() as c_int +} fn align_to_flags(align: usize) -> c_int { - if align <= MIN_ALIGN { 0 } else { mallocx_align(align) } + if align <= MIN_ALIGN { + 0 + } else { + mallocx_align(align) + } } #[no_mangle] -pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 { +pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 { let flags = align_to_flags(align); unsafe { je_mallocx(size as size_t, flags) as *mut u8 } } #[no_mangle] -pub extern fn __rust_reallocate(ptr: *mut u8, _old_size: usize, size: usize, - align: usize) -> *mut u8 { +pub extern "C" fn __rust_reallocate(ptr: *mut u8, + _old_size: usize, + size: usize, + align: usize) + -> *mut u8 { let flags = align_to_flags(align); unsafe { je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8 } } #[no_mangle] -pub extern fn __rust_reallocate_inplace(ptr: *mut u8, _old_size: usize, - size: usize, align: usize) -> usize { +pub extern "C" fn __rust_reallocate_inplace(ptr: *mut u8, + _old_size: usize, + size: usize, + align: usize) + -> usize { let flags = align_to_flags(align); unsafe { je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as usize } } #[no_mangle] -pub extern fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) { +pub extern "C" fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) { let flags = align_to_flags(align); unsafe { je_sdallocx(ptr as *mut c_void, old_size as size_t, flags) } } #[no_mangle] -pub extern fn __rust_usable_size(size: usize, align: usize) -> usize { +pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize { let flags = align_to_flags(align); unsafe { je_nallocx(size as size_t, flags) as usize } } |
