From 4abe2fc86d0fcaedc5dff1a841c6276705a976a5 Mon Sep 17 00:00:00 2001 From: Sebastian Lauwers Date: Sat, 21 Feb 2015 00:27:54 +0100 Subject: Use new ffi:CStr instead of c_str_to_bytes_with_nul --- src/sys/utsname.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sys') diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index 028caa6c..b6641ebb 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -1,6 +1,6 @@ use std::mem; use libc::{c_char}; -use std::ffi::{c_str_to_bytes_with_nul}; +use std::ffi::CStr; use std::str::from_utf8_unchecked; mod ffi { @@ -61,7 +61,7 @@ pub fn uname() -> UtsName { #[inline] fn to_str<'a>(s: *const *const c_char) -> &'a str { unsafe { - let res = c_str_to_bytes_with_nul(mem::transmute(s)); + let res = CStr::from_ptr(*s).to_bytes_with_nul(); from_utf8_unchecked(res) } } -- cgit v1.2.3