1
0
Fork 0

minor style fixes

This commit is contained in:
edef 2016-03-16 00:20:45 +01:00
parent bb2b92bf6b
commit 4ffdba3ea6
2 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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)
}
}