Remove unnecessary unsafe block

The `unsafe` is not needed here, as the `select64` is already a safe wrapper
around the `C_select64` function.

Closes #10659
This commit is contained in:
Dezhi Wu 2024-08-10 10:25:36 +08:00 committed by Johannes Altmanninger
parent 09797acf92
commit 09b8b94025

View File

@ -70,23 +70,19 @@ impl FdReadableSet {
let null = std::ptr::null_mut();
use crate::libc::{select64, timeval64};
if timeout_usec == Self::kNoTimeout {
unsafe {
return select64(
self.nfds_,
&mut self.fdset_,
null,
null,
std::ptr::null_mut(),
);
}
return select64(
self.nfds_,
&mut self.fdset_,
null,
null,
std::ptr::null_mut(),
);
} else {
let mut tvs = timeval64 {
tv_sec: (timeout_usec / kUsecPerSec).try_into().unwrap(),
tv_usec: (timeout_usec % kUsecPerSec).try_into().unwrap(),
};
unsafe {
return select64(self.nfds_, &mut self.fdset_, null, null, &mut tvs);
}
return select64(self.nfds_, &mut self.fdset_, null, null, &mut tvs);
}
}