minor style fixes
This commit is contained in:
parent
bb2b92bf6b
commit
4ffdba3ea6
|
@ -36,9 +36,10 @@ impl Stack {
|
|||
Stack { ptr: ptr as *mut u8, len: len }
|
||||
};
|
||||
|
||||
try!(unsafe {
|
||||
if sys::protect_stack(stack.ptr) { Ok(()) }
|
||||
else { Err(IoError::last_os_error()) }
|
||||
try!(if unsafe { sys::protect_stack(stack.ptr) } {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(IoError::last_os_error())
|
||||
});
|
||||
|
||||
Ok(stack)
|
||||
|
|
|
@ -32,11 +32,10 @@ const STACK_FLAGS: c_int = libc::MAP_PRIVATE
|
|||
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
|
||||
let ptr = mmap(ptr::null_mut(), len as size_t,
|
||||
STACK_PROT, STACK_FLAGS, -1, 0);
|
||||
if ptr != MAP_FAILED {
|
||||
Some(ptr as *mut u8)
|
||||
}
|
||||
else {
|
||||
if ptr == MAP_FAILED {
|
||||
None
|
||||
} else {
|
||||
Some(ptr as *mut u8)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue