From f682ca69b356755fe6c06bcdd8f4fab73f7d2c78 Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Wed, 22 Nov 2023 18:57:28 -0300 Subject: Rust API : Add HLIL Bindings --- rust/src/mlil/function.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'rust/src/mlil/function.rs') diff --git a/rust/src/mlil/function.rs b/rust/src/mlil/function.rs index 63c63a34..8f5ed73d 100644 --- a/rust/src/mlil/function.rs +++ b/rust/src/mlil/function.rs @@ -26,21 +26,21 @@ unsafe impl Sync for MediumLevelILFunction {} impl Eq for MediumLevelILFunction {} impl PartialEq for MediumLevelILFunction { fn eq(&self, rhs: &Self) -> bool { - self.handle == rhs.handle + self.get_function().eq(&rhs.get_function()) } } impl Hash for MediumLevelILFunction { fn hash(&self, state: &mut H) { - self.handle.hash(state); + self.get_function().hash(state) } } impl MediumLevelILFunction { - pub(crate) unsafe fn from_raw(handle: *mut BNMediumLevelILFunction) -> Self { + pub(crate) unsafe fn ref_from_raw(handle: *mut BNMediumLevelILFunction) -> Ref { debug_assert!(!handle.is_null()); - Self { handle } + Self { handle }.to_owned() } pub fn instruction_at>(&self, loc: L) -> Option { @@ -53,12 +53,12 @@ impl MediumLevelILFunction { if expr_idx >= self.instruction_count() { None } else { - Some(MediumLevelILInstruction::new(self, expr_idx)) + Some(MediumLevelILInstruction::new(self.to_owned(), expr_idx)) } } pub fn instruction_from_idx(&self, expr_idx: usize) -> MediumLevelILInstruction { - MediumLevelILInstruction::new(self, expr_idx) + MediumLevelILInstruction::new(self.to_owned(), expr_idx) } pub fn instruction_count(&self) -> usize { -- cgit v1.3.1