move sallocx and excess into not null branch
This commit is contained in:
@@ -229,13 +229,14 @@ mod contents {
|
|||||||
|
|
||||||
let flags = align_to_flags(new_align);
|
let flags = align_to_flags(new_align);
|
||||||
let ptr = rallocx(ptr as *mut c_void, new_size, flags) as *mut u8;
|
let ptr = rallocx(ptr as *mut c_void, new_size, flags) as *mut u8;
|
||||||
let alloc_size = sallocx(ptr as *mut c_void, flags);
|
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
let layout = Layout::from_size_align_unchecked(new_size, new_align);
|
let layout = Layout::from_size_align_unchecked(new_size, new_align);
|
||||||
ptr::write(err as *mut AllocErr,
|
ptr::write(err as *mut AllocErr,
|
||||||
AllocErr::Exhausted { request: layout });
|
AllocErr::Exhausted { request: layout });
|
||||||
|
} else {
|
||||||
|
let alloc_size = sallocx(ptr as *mut c_void, flags);
|
||||||
|
*excess = alloc_size;
|
||||||
}
|
}
|
||||||
*excess = alloc_size;
|
|
||||||
ptr
|
ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user