diff options
| author | Rubens Brandao <git@rubens.io> | 2023-11-22 18:57:28 -0300 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-02-02 13:32:45 -0500 |
| commit | f682ca69b356755fe6c06bcdd8f4fab73f7d2c78 (patch) | |
| tree | 3cfc324cfe8043ccc8db1161f1f90c448d097c8a /rust/src/mlil/function.rs | |
| parent | e1a6bdcd576f7caeaa6f97ff1e337a259057b333 (diff) | |
Rust API : Add HLIL Bindings
Diffstat (limited to 'rust/src/mlil/function.rs')
| -rw-r--r-- | rust/src/mlil/function.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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<H: Hasher>(&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<Self> { debug_assert!(!handle.is_null()); - Self { handle } + Self { handle }.to_owned() } pub fn instruction_at<L: Into<Location>>(&self, loc: L) -> Option<MediumLevelILInstruction> { @@ -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 { |
