add #[allow(deprecated)] annotations

allow using deprecated functions and data structures
in deprecated functions
This commit is contained in:
sourceturner
2026-04-19 21:51:46 +02:00
committed by sourceturner
parent 885118ccac
commit 4ffd337b9b
12 changed files with 67 additions and 19 deletions
+10 -5
View File
@@ -9,11 +9,10 @@
use core::ptr::NonNull;
#[allow(deprecated)]
use crate::header::sys_time::gettimeofday;
use crate::{
header::{
sys_select::timeval,
sys_time::{gettimeofday, timezone},
},
header::{sys_select::timeval, sys_time::timezone},
platform::types::{c_int, c_short, c_ushort, time_t},
};
@@ -34,6 +33,7 @@ pub struct timeb {
/// The caller must ensure that `tp` is convertible to a `&mut
/// MaybeUninit<timeb>`.
#[deprecated]
#[allow(deprecated)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn ftime(tp: *mut timeb) -> c_int {
// SAFETY: the caller is required to ensure that the pointer is valid.
@@ -44,10 +44,15 @@ pub unsafe extern "C" fn ftime(tp: *mut timeb) -> c_int {
// SAFETY: tv and tz are created above, and thus will coerce to valid
// pointers.
if unsafe { gettimeofday(&raw mut tv, &raw mut tz) } < 0 {
if unsafe {
#[allow(deprecated)]
gettimeofday(&raw mut tv, &raw mut tz)
} < 0
{
return -1;
}
#[allow(deprecated)]
tp_maybe_uninit.write(timeb {
time: tv.tv_sec,
millitm: (tv.tv_usec / 1000) as c_ushort,