Skip to content

Commit

Permalink
clash_ffi: remove unnecessary unsafe block (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
cppcoffee authored Jan 28, 2025
1 parent 34a1771 commit 8f86d58
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions clash_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@ pub unsafe extern "C" fn clash_start(
cwd: *const c_char,
multithread: c_int,
) -> *mut c_char {
let config_str = unsafe { CStr::from_ptr(config) }
.to_str()
.unwrap_or_default()
.to_string();
let log_str = unsafe { CStr::from_ptr(log) }
.to_str()
.unwrap_or_default()
.to_string();
let cwd_str = unsafe { CStr::from_ptr(cwd) }
let config_str = CStr::from_ptr(config)
.to_str()
.unwrap_or_default()
.to_string();
let log_str = CStr::from_ptr(log).to_str().unwrap_or_default().to_string();
let cwd_str = CStr::from_ptr(cwd).to_str().unwrap_or_default().to_string();

let rt = if multithread != 0 {
Some(TokioRuntime::MultiThread)
} else {
Expand Down

0 comments on commit 8f86d58

Please sign in to comment.