Remove c_str functions, replace with CStr

This commit is contained in:
Jeremy Soller
2018-09-24 21:08:29 -06:00
parent ef9fee5a2b
commit 7f14fcdee0
8 changed files with 29 additions and 62 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
use core::fmt::Write as CoreWrite;
use core::{ptr, slice, str};
use c_str::CStr;
use platform::types::*;
use platform::{self, WriteByte};
use va_list::VaList;
@@ -62,7 +63,8 @@ pub unsafe fn printf<W: WriteByte>(w: W, format: *const c_char, mut ap: VaList)
found_percent = false;
if a != ptr::null() {
w.write_str(str::from_utf8_unchecked(platform::c_str(a)))
let a_cstr = CStr::from_ptr(a);
w.write_str(str::from_utf8_unchecked(a_cstr.to_bytes()))
} else {
w.write_str("NULL")
}