mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
uucore: set the unsafe at the right place
This commit is contained in:
parent
a85539f530
commit
d671849b7f
1 changed files with 2 additions and 2 deletions
|
@ -164,11 +164,11 @@ pub struct Passwd {
|
|||
/// ptr must point to a valid C string.
|
||||
///
|
||||
/// Returns None if ptr is null.
|
||||
unsafe fn cstr2string(ptr: *const c_char) -> Option<String> {
|
||||
fn cstr2string(ptr: *const c_char) -> Option<String> {
|
||||
if ptr.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(CStr::from_ptr(ptr).to_string_lossy().into_owned())
|
||||
Some(unsafe { CStr::from_ptr(ptr).to_string_lossy().into_owned() })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue