summaryrefslogtreecommitdiff
path: root/rust/src/template_simplifier.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/template_simplifier.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/template_simplifier.rs')
-rw-r--r--rust/src/template_simplifier.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/rust/src/template_simplifier.rs b/rust/src/template_simplifier.rs
index 57d2b0b4..c9e54e72 100644
--- a/rust/src/template_simplifier.rs
+++ b/rust/src/template_simplifier.rs
@@ -6,15 +6,10 @@ use binaryninjacore_sys::{BNRustSimplifyStrToFQN, BNRustSimplifyStrToStr};
pub fn simplify_str_to_str<S: AsCStr>(input: S) -> BnString {
let name = input.to_cstr();
- unsafe { BnString::from_raw(BNRustSimplifyStrToStr(name.as_ref().as_ptr() as *mut _)) }
+ unsafe { BnString::from_raw(BNRustSimplifyStrToStr(name.as_ptr())) }
}
pub fn simplify_str_to_fqn<S: AsCStr>(input: S, simplify: bool) -> QualifiedName {
let name = input.to_cstr();
- unsafe {
- QualifiedName::from_owned_raw(BNRustSimplifyStrToFQN(
- name.as_ref().as_ptr() as *mut _,
- simplify,
- ))
- }
+ unsafe { QualifiedName::from_owned_raw(BNRustSimplifyStrToFQN(name.as_ptr(), simplify)) }
}