From 6940716b18fb4bd0aaf60a76e4e23e58b7458e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Sun, 20 Oct 2024 09:55:28 +0300 Subject: [PATCH] Rename `__getrandom_custom` to `__getrandom_v03_custom` --- nopanic_check/src/lib.rs | 2 +- src/custom.rs | 4 ++-- src/lib.rs | 10 ++++++++-- tests/mod.rs | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/nopanic_check/src/lib.rs b/nopanic_check/src/lib.rs index af2c8ee3..37c4d28e 100644 --- a/nopanic_check/src/lib.rs +++ b/nopanic_check/src/lib.rs @@ -19,7 +19,7 @@ pub extern "C" fn getrandom_wrapper(buf_ptr: *mut u8, buf_len: usize) -> u32 { #[cfg(getrandom_backend = "custom")] #[no_mangle] -unsafe extern "Rust" fn __getrandom_custom( +unsafe extern "Rust" fn __getrandom_v03_custom( dest: *mut u8, len: usize, ) -> Result<(), getrandom::Error> { diff --git a/src/custom.rs b/src/custom.rs index fc216e08..c3e94349 100644 --- a/src/custom.rs +++ b/src/custom.rs @@ -4,7 +4,7 @@ use core::mem::MaybeUninit; pub fn getrandom_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { extern "Rust" { - fn __getrandom_custom(dest: *mut u8, len: usize) -> Result<(), Error>; + fn __getrandom_v03_custom(dest: *mut u8, len: usize) -> Result<(), Error>; } - unsafe { __getrandom_custom(dest.as_mut_ptr().cast(), dest.len()) } + unsafe { __getrandom_v03_custom(dest.as_mut_ptr().cast(), dest.len()) } } diff --git a/src/lib.rs b/src/lib.rs index 386e5906..0a2b2a31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,10 @@ //! use getrandom::Error; //! //! #[no_mangle] -//! unsafe extern "Rust" fn __getrandom_custom(dest: *mut u8, len: usize) -> Result<(), Error> { +//! unsafe extern "Rust" fn __getrandom_v03_custom( +//! dest: *mut u8, +//! len: usize, +//! ) -> Result<(), Error> { //! todo!() //! } //! ``` @@ -133,7 +136,10 @@ //! use getrandom::Error; //! //! #[no_mangle] -//! unsafe extern "Rust" fn __getrandom_custom(dest: *mut u8, len: usize) -> Result<(), Error> { +//! unsafe extern "Rust" fn __getrandom_v03_custom( +//! dest: *mut u8, +//! len: usize, +//! ) -> Result<(), Error> { //! Err(Error::UNSUPPORTED) //! } //! ``` diff --git a/tests/mod.rs b/tests/mod.rs index 33083df5..47bc1b27 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -206,7 +206,7 @@ mod custom { // // WARNING: this custom implementation is for testing purposes ONLY! #[no_mangle] - unsafe extern "Rust" fn __getrandom_custom(dest: *mut u8, len: usize) -> Result<(), Error> { + unsafe extern "Rust" fn __getrandom_v03_custom(dest: *mut u8, len: usize) -> Result<(), Error> { use std::time::{SystemTime, UNIX_EPOCH}; assert_ne!(len, 0);