forked from M-Labs/libfringe
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 }
|
Stack { ptr: ptr as *mut u8, len: len }
|
||||||
};
|
};
|
||||||
|
|
||||||
try!(unsafe {
|
try!(if unsafe { sys::protect_stack(stack.ptr) } {
|
||||||
if sys::protect_stack(stack.ptr) { Ok(()) }
|
Ok(())
|
||||||
else { Err(IoError::last_os_error()) }
|
} else {
|
||||||
|
Err(IoError::last_os_error())
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(stack)
|
Ok(stack)
|
||||||
|
|
|
@ -32,11 +32,10 @@ const STACK_FLAGS: c_int = libc::MAP_PRIVATE
|
||||||
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
|
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
|
||||||
let ptr = mmap(ptr::null_mut(), len as size_t,
|
let ptr = mmap(ptr::null_mut(), len as size_t,
|
||||||
STACK_PROT, STACK_FLAGS, -1, 0);
|
STACK_PROT, STACK_FLAGS, -1, 0);
|
||||||
if ptr != MAP_FAILED {
|
if ptr == MAP_FAILED {
|
||||||
Some(ptr as *mut u8)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
None
|
None
|
||||||
|
} else {
|
||||||
|
Some(ptr as *mut u8)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue