diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -1,9 +1,9 @@ use std::char; -use std::ffi::{self, CStr}; use std::io; -use libc; mod bindings; +mod util; +pub mod widgets; // #[cfg(test)] // mod tests { @@ -184,9 +184,6 @@ pub fn get_line() -> Option<String> { if ptr.is_null() { None } else { - let bytes = unsafe { CStr::from_ptr(ptr).to_bytes() }; - let res = Some(String::from_utf8(bytes.to_vec()).unwrap()); - unsafe { libc::free(ptr as *mut ffi::c_void); } - res + unsafe { Some(util::string_from_utf8_charp(ptr)) } } } |