summaryrefslogtreecommitdiff
path: root/rust/src/disassembly.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:10:56 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commita826c589dfc10c542deba7ca3343a462e02d6bde (patch)
treef116254bef39f787268bbecc5eac19da310db9ce /rust/src/disassembly.rs
parent28b3c4044af06fdc32c9c85bf8381b5058306427 (diff)
[Rust] Simplify `BnStrCompatible` trait
Followup to https://github.com/Vector35/binaryninja-api/pull/5897/ This simplifies usage of the trait in user code, should just be able to `to_cstr` to get the cstr repr and then call `as_ptr`. Co-authored-by: Michael Krasnitski <michael.krasnitski@gmail.com>
Diffstat (limited to 'rust/src/disassembly.rs')
-rw-r--r--rust/src/disassembly.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs
index 6125f623..5964324d 100644
--- a/rust/src/disassembly.rs
+++ b/rust/src/disassembly.rs
@@ -22,7 +22,7 @@ use crate::function::{Location, NativeBlock};
use crate::high_level_il as hlil;
use crate::low_level_il as llil;
use crate::medium_level_il as mlil;
-use crate::string::BnStrCompatible;
+use crate::string::AsCStr;
use crate::string::{raw_to_string, strings_to_string_list, BnString};
use crate::rc::*;
@@ -1242,7 +1242,7 @@ impl DisassemblyTextRenderer {
unsafe { Array::new(tokens, count, ()) }
}
- pub fn wrap_comment<S1: BnStrCompatible, S2: BnStrCompatible, S3: BnStrCompatible>(
+ pub fn wrap_comment<S1: AsCStr, S2: AsCStr, S3: AsCStr>(
&self,
cur_line: DisassemblyTextLine,
comment: S1,
@@ -1251,9 +1251,9 @@ impl DisassemblyTextRenderer {
indent_spaces: S3,
) -> Array<DisassemblyTextLine> {
let cur_line_raw = DisassemblyTextLine::into_raw(cur_line);
- let comment_raw = comment.into_bytes_with_nul();
- let leading_spaces_raw = leading_spaces.into_bytes_with_nul();
- let indent_spaces_raw = indent_spaces.into_bytes_with_nul();
+ let comment_raw = comment.to_cstr();
+ let leading_spaces_raw = leading_spaces.to_cstr();
+ let indent_spaces_raw = indent_spaces.to_cstr();
let mut count = 0;
let lines = unsafe {
BNDisassemblyTextRendererWrapComment(