From 90f908e33c071720631cbd732cdf882b6b478cb0 Mon Sep 17 00:00:00 2001 From: veqcc Date: Mon, 7 Oct 2024 13:27:42 +0900 Subject: [PATCH] avoid clippy suppression Signed-off-by: veqcc --- src/agnocast_heaphook_rust/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/agnocast_heaphook_rust/src/lib.rs b/src/agnocast_heaphook_rust/src/lib.rs index cd4ce8fc..c91c9983 100644 --- a/src/agnocast_heaphook_rust/src/lib.rs +++ b/src/agnocast_heaphook_rust/src/lib.rs @@ -47,7 +47,7 @@ static ORIGINAL_REALLOC: LazyLock = LazyLock::new(|| { } }); -type PosixMemalignType = unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> i32; +type PosixMemalignType = unsafe extern "C" fn(&mut *mut c_void, usize, usize) -> i32; static ORIGINAL_POSIX_MEMALIGN: LazyLock = LazyLock::new(|| { let symbol: &CStr = CStr::from_bytes_with_nul(b"posix_memalign\0").unwrap(); unsafe { @@ -270,14 +270,13 @@ pub extern "C" fn realloc(ptr: *mut c_void, new_size: usize) -> *mut c_void { } #[no_mangle] -#[allow(clippy::not_unsafe_ptr_arg_deref)] -pub extern "C" fn posix_memalign(memptr: *mut *mut c_void, alignment: usize, size: usize) -> i32 { +pub extern "C" fn posix_memalign(memptr: &mut *mut c_void, alignment: usize, size: usize) -> i32 { HOOKED.with(|hooked: &Cell| { if hooked.get() { unsafe { ORIGINAL_POSIX_MEMALIGN(memptr, alignment, size) } } else { hooked.set(true); - unsafe { *memptr = tlsf_aligned_alloc(alignment, size) }; + *memptr = tlsf_aligned_alloc(alignment, size); hooked.set(false); 0 }