summaryrefslogtreecommitdiff
path: root/rust/src/worker_thread.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:47:55 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit788a8b7091bbdde77817030e0836d7a7a786fd99 (patch)
tree40e8f8d3c870788259a5acb5d14995cdc1656979 /rust/src/worker_thread.rs
parenta826c589dfc10c542deba7ca3343a462e02d6bde (diff)
[Rust] Simplify usage surrounding c strings
`cstring.as_ref().as_ptr() as *const c_char` -> `cstring.as_ptr()` `cstring.as_ref().as_ptr() as *mut _` -> `cstring.as_ptr()` `cstring.as_ptr() as *const c_char` -> `cstring.as_ptr()` With a few fixes for cstrings that might be dropped prematurely.
Diffstat (limited to 'rust/src/worker_thread.rs')
-rw-r--r--rust/src/worker_thread.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/rust/src/worker_thread.rs b/rust/src/worker_thread.rs
index aed872de..e0d7b0db 100644
--- a/rust/src/worker_thread.rs
+++ b/rust/src/worker_thread.rs
@@ -1,6 +1,6 @@
use crate::string::AsCStr;
use binaryninjacore_sys::*;
-use std::ffi::{c_char, c_void};
+use std::ffi::c_void;
pub struct WorkerThreadActionExecutor {
func: Box<dyn Fn()>,
@@ -25,7 +25,7 @@ pub fn execute_on_worker_thread<F: Fn() + 'static, S: AsCStr>(name: S, f: F) {
BNWorkerEnqueueNamed(
raw_executor as *mut c_void,
Some(WorkerThreadActionExecutor::cb_execute),
- name.as_ref().as_ptr() as *const c_char,
+ name.as_ptr(),
)
}
}
@@ -38,7 +38,7 @@ pub fn execute_on_worker_thread_priority<F: Fn() + 'static, S: AsCStr>(name: S,
BNWorkerPriorityEnqueueNamed(
raw_executor as *mut c_void,
Some(WorkerThreadActionExecutor::cb_execute),
- name.as_ref().as_ptr() as *const c_char,
+ name.as_ptr(),
)
}
}
@@ -51,7 +51,7 @@ pub fn execute_on_worker_thread_interactive<F: Fn() + 'static, S: AsCStr>(name:
BNWorkerInteractiveEnqueueNamed(
raw_executor as *mut c_void,
Some(WorkerThreadActionExecutor::cb_execute),
- name.as_ref().as_ptr() as *const c_char,
+ name.as_ptr(),
)
}
}