Merge branch 'assert-unsafe-blocks' into 'master'
Use unsafe blocks in assert.h implementation See merge request redox-os/relibc!502
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
|
||||
|
||||
// TODO: set this for entire crate when possible
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
use crate::{c_str::CStr, platform::types::*};
|
||||
|
||||
#[no_mangle]
|
||||
@@ -9,9 +12,9 @@ pub unsafe extern "C" fn __assert_fail(
|
||||
line: c_int,
|
||||
cond: *const c_char,
|
||||
) -> ! {
|
||||
let func = CStr::from_ptr(func).to_str().unwrap();
|
||||
let file = CStr::from_ptr(file).to_str().unwrap();
|
||||
let cond = CStr::from_ptr(cond).to_str().unwrap();
|
||||
let func = unsafe { CStr::from_ptr(func) }.to_str().unwrap();
|
||||
let file = unsafe { CStr::from_ptr(file) }.to_str().unwrap();
|
||||
let cond = unsafe { CStr::from_ptr(cond) }.to_str().unwrap();
|
||||
|
||||
eprintln!("{}: {}:{}: Assertion `{}` failed.", func, file, line, cond);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user