Skip to content

Commit 5ea1f9f

Browse files
committed
Run rustfmt on liballoc_jemalloc.
1 parent 81b3b27 commit 5ea1f9f

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/liballoc_jemalloc/lib.rs

+22-11
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ use libc::{c_int, c_void, size_t};
4343
extern {
4444
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
4545
fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
46-
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t,
47-
flags: c_int) -> size_t;
46+
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
4847
fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
4948
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
5049
}
@@ -63,40 +62,52 @@ const MIN_ALIGN: usize = 8;
6362
const MIN_ALIGN: usize = 16;
6463

6564
// MALLOCX_ALIGN(a) macro
66-
fn mallocx_align(a: usize) -> c_int { a.trailing_zeros() as c_int }
65+
fn mallocx_align(a: usize) -> c_int {
66+
a.trailing_zeros() as c_int
67+
}
6768

6869
fn align_to_flags(align: usize) -> c_int {
69-
if align <= MIN_ALIGN { 0 } else { mallocx_align(align) }
70+
if align <= MIN_ALIGN {
71+
0
72+
} else {
73+
mallocx_align(align)
74+
}
7075
}
7176

7277
#[no_mangle]
73-
pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
78+
pub extern "C" fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
7479
let flags = align_to_flags(align);
7580
unsafe { je_mallocx(size as size_t, flags) as *mut u8 }
7681
}
7782

7883
#[no_mangle]
79-
pub extern fn __rust_reallocate(ptr: *mut u8, _old_size: usize, size: usize,
80-
align: usize) -> *mut u8 {
84+
pub extern "C" fn __rust_reallocate(ptr: *mut u8,
85+
_old_size: usize,
86+
size: usize,
87+
align: usize)
88+
-> *mut u8 {
8189
let flags = align_to_flags(align);
8290
unsafe { je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8 }
8391
}
8492

8593
#[no_mangle]
86-
pub extern fn __rust_reallocate_inplace(ptr: *mut u8, _old_size: usize,
87-
size: usize, align: usize) -> usize {
94+
pub extern "C" fn __rust_reallocate_inplace(ptr: *mut u8,
95+
_old_size: usize,
96+
size: usize,
97+
align: usize)
98+
-> usize {
8899
let flags = align_to_flags(align);
89100
unsafe { je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as usize }
90101
}
91102

92103
#[no_mangle]
93-
pub extern fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) {
104+
pub extern "C" fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) {
94105
let flags = align_to_flags(align);
95106
unsafe { je_sdallocx(ptr as *mut c_void, old_size as size_t, flags) }
96107
}
97108

98109
#[no_mangle]
99-
pub extern fn __rust_usable_size(size: usize, align: usize) -> usize {
110+
pub extern "C" fn __rust_usable_size(size: usize, align: usize) -> usize {
100111
let flags = align_to_flags(align);
101112
unsafe { je_nallocx(size as size_t, flags) as usize }
102113
}

0 commit comments

Comments
 (0)