Skip to content

Commit

Permalink
Remove unnecessary "unsafe" block to fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hurufu committed Sep 6, 2024
1 parent 2b73107 commit 7af93f1
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,25 @@ impl ForeignFunctionTable {
}

fn map_type_ffi(&mut self, source: &Atom) -> *mut ffi_type {
unsafe {
match source {
atom!("sint64") => addr_of_mut!(types::sint64),
atom!("sint32") => addr_of_mut!(types::sint32),
atom!("sint16") => addr_of_mut!(types::sint16),
atom!("sint8") => addr_of_mut!(types::sint8),
atom!("uint64") => addr_of_mut!(types::uint64),
atom!("uint32") => addr_of_mut!(types::uint32),
atom!("uint16") => addr_of_mut!(types::uint16),
atom!("uint8") => addr_of_mut!(types::uint8),
atom!("bool") => addr_of_mut!(types::sint8),
atom!("void") => addr_of_mut!(types::void),
atom!("cstr") => addr_of_mut!(types::pointer),
atom!("ptr") => addr_of_mut!(types::pointer),
atom!("f32") => addr_of_mut!(types::float),
atom!("f64") => addr_of_mut!(types::double),
struct_name => match self.structs.get_mut(&*struct_name.as_str()) {
Some(ref mut struct_type) => &mut struct_type.ffi_type,
None => unreachable!(),
},
}
match source {
atom!("sint64") => addr_of_mut!(types::sint64),
atom!("sint32") => addr_of_mut!(types::sint32),
atom!("sint16") => addr_of_mut!(types::sint16),
atom!("sint8") => addr_of_mut!(types::sint8),
atom!("uint64") => addr_of_mut!(types::uint64),
atom!("uint32") => addr_of_mut!(types::uint32),
atom!("uint16") => addr_of_mut!(types::uint16),
atom!("uint8") => addr_of_mut!(types::uint8),
atom!("bool") => addr_of_mut!(types::sint8),
atom!("void") => addr_of_mut!(types::void),
atom!("cstr") => addr_of_mut!(types::pointer),
atom!("ptr") => addr_of_mut!(types::pointer),
atom!("f32") => addr_of_mut!(types::float),
atom!("f64") => addr_of_mut!(types::double),
struct_name => match self.structs.get_mut(&*struct_name.as_str()) {
Some(ref mut struct_type) => &mut struct_type.ffi_type,
None => unreachable!(),
},
}
}

Expand Down

0 comments on commit 7af93f1

Please sign in to comment.