From 7090d904513c3e80321bb6a8aba9c3b37d809bac Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sat, 6 Dec 2025 17:06:16 -0500 Subject: [Rust] Remove redundant `ArchAndAddr` type Use `Location` instead, `arch` can be a nullptr --- rust/src/binary_view.rs | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'rust/src/binary_view.rs') diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index 4b55e321..e1b7a5c0 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -38,7 +38,7 @@ use crate::external_library::{ExternalLibrary, ExternalLocation}; use crate::file_accessor::{Accessor, FileAccessor}; use crate::file_metadata::FileMetadata; use crate::flowgraph::FlowGraph; -use crate::function::{ArchAndAddr, Function, FunctionViewType, NativeBlock}; +use crate::function::{Function, FunctionViewType, Location, NativeBlock}; use crate::linear_view::{LinearDisassemblyLine, LinearViewCursor}; use crate::metadata::Metadata; use crate::platform::Platform; @@ -1445,29 +1445,23 @@ pub trait BinaryViewExt: BinaryViewBase { } } + // TODO: Should this instead be implemented on [`Function`] considering `src_func`? `Location` is local to the source function. fn should_skip_target_analysis( &self, - source: &ArchAndAddr, - srcfunc: &Function, - srcend: u64, - target: &ArchAndAddr, + src_loc: impl Into, + src_func: &Function, + src_end: u64, + target: impl Into, ) -> bool { - let mut srccopy = BNArchitectureAndAddress { - arch: source.arch.handle, - address: source.addr, - }; - let mut targetcopy = BNArchitectureAndAddress { - arch: target.arch.handle, - address: target.addr, - }; - + let src_loc = src_loc.into(); + let target = target.into(); unsafe { BNShouldSkipTargetAnalysis( self.as_ref().handle, - &mut srccopy, - srcfunc.handle, - srcend, - &mut targetcopy, + &mut src_loc.into(), + src_func.handle, + src_end, + &mut target.into(), ) } } -- cgit v1.3.1