summaryrefslogtreecommitdiff
path: root/src/sys/select.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2019-08-30 23:10:22 -0600
committerAlan Somers <asomers@gmail.com>2019-09-03 16:25:41 -0600
commit469032433d68841ad098f03aa2b28e81235b8be8 (patch)
treea34108f1688355ebaa6d5eed8a2eecafc5d32dfa /src/sys/select.rs
parenta4a465d25567f163f9552b977eb4d17435251d41 (diff)
downloadnix-469032433d68841ad098f03aa2b28e81235b8be8.zip
Replace most instances of mem::uninitialized with mem::MaybeUninit
Only two instances remain: * For the deprecated sys::socket::CmsgSpace::new. We should probably just remove that method. * For sys::termios::Termios::default_uninit. This will require some more thought. Fixes #1096
Diffstat (limited to 'src/sys/select.rs')
-rw-r--r--src/sys/select.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sys/select.rs b/src/sys/select.rs
index 9d60ffaf..32569acc 100644
--- a/src/sys/select.rs
+++ b/src/sys/select.rs
@@ -9,16 +9,17 @@ use sys::time::{TimeSpec, TimeVal};
pub use libc::FD_SETSIZE;
-// FIXME: Change to repr(transparent) once it's stable
-#[repr(C)]
+#[repr(transparent)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct FdSet(libc::fd_set);
impl FdSet {
pub fn new() -> FdSet {
- let mut fdset = unsafe { mem::uninitialized() };
- unsafe { libc::FD_ZERO(&mut fdset) };
- FdSet(fdset)
+ let mut fdset = mem::MaybeUninit::uninit();
+ unsafe {
+ libc::FD_ZERO(fdset.as_mut_ptr());
+ FdSet(fdset.assume_init())
+ }
}
pub fn insert(&mut self, fd: RawFd) {