From db51a3a92dde199ea0c3ac10ed87bde11376f953 Mon Sep 17 00:00:00 2001 From: Jesus Hernandez Date: Sat, 27 Apr 2024 14:17:29 +0200 Subject: [PATCH] fix: Add changes needed in commit of mode validation to submodule (human error) --- src/lib.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e11f140..a37b5a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,25 +27,7 @@ use error::PointerError; #[cfg(all(feature = "std", feature = "lender"))] mod lender; -#[inline] -fn validate_pointer_is_not_null(pointer: *const T) -> Result<(), PointerError> { - if pointer.is_null() { - log::error!("Using a NULL pointer as an opaque pointer to Rust's data"); - return Err(PointerError::Null); - } - return Ok(()); -} - -#[inline] -fn validate_pointer(pointer: *const T) -> Result<(), PointerError> { - validate_pointer_is_not_null(pointer)?; - #[cfg(all(feature = "std", feature = "lender"))] - if !lender::is_lent(pointer) { - log::error!("Using an invalid pointer as an opaque pointer to Rust's data"); - return Err(PointerError::Invalid); - } - return Ok(()); -} +mod validation; /// Get a heap-allocated raw pointer without ownership. ///