Skip to content
Snippets Groups Projects
Commit bf46e331 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge branch 'assert-unsafe-blocks' into 'master'

Use unsafe blocks in assert.h implementation

See merge request redox-os/relibc!502
parents 753ddef6 8c583cc9
No related branches found
No related tags found
No related merge requests found
//! 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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment