diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-25 12:47:34 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-28 11:53:58 -0700 |
| commit | 0dfc90ab15475aa64bea393671463a8e9784ae3f (patch) | |
| tree | 41c9c856c504f33552abe4a0eca9fbdc3d5d215d /src/libnative/io/util.rs | |
| parent | 2823be08b7d1b9106cbbd454437384c093c5a5fa (diff) | |
| download | rust-0dfc90ab15475aa64bea393671463a8e9784ae3f.tar.gz rust-0dfc90ab15475aa64bea393671463a8e9784ae3f.zip | |
Rename all raw pointers as necessary
Diffstat (limited to 'src/libnative/io/util.rs')
| -rw-r--r-- | src/libnative/io/util.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libnative/io/util.rs b/src/libnative/io/util.rs index a3c5349fa45..31ba2223082 100644 --- a/src/libnative/io/util.rs +++ b/src/libnative/io/util.rs @@ -90,7 +90,7 @@ pub fn set_nonblocking(fd: net::sock_t, nb: bool) -> IoResult<()> { // See http://developerweb.net/viewtopic.php?id=3196 for where this is // derived from. pub fn connect_timeout(fd: net::sock_t, - addrp: *libc::sockaddr, + addrp: *const libc::sockaddr, len: libc::socklen_t, timeout_ms: u64) -> IoResult<()> { use std::os; @@ -145,16 +145,16 @@ pub fn connect_timeout(fd: net::sock_t, // Recalculate the timeout each iteration (it is generally // undefined what the value of the 'tv' is after select // returns EINTR). - let tv = ms_to_timeval(timeout - (::io::timer::now() - start)); - c::select(fd + 1, ptr::null(), set as *mut _ as *_, - ptr::null(), &tv) + let mut tv = ms_to_timeval(timeout - (::io::timer::now() - start)); + c::select(fd + 1, ptr::mut_null(), set as *mut _, + ptr::mut_null(), &mut tv) }) } #[cfg(windows)] fn await(_fd: net::sock_t, set: &mut c::fd_set, timeout: u64) -> libc::c_int { - let tv = ms_to_timeval(timeout); - unsafe { c::select(1, ptr::null(), &*set, ptr::null(), &tv) } + let mut tv = ms_to_timeval(timeout); + unsafe { c::select(1, ptr::mut_null(), set, ptr::mut_null(), &mut tv) } } } @@ -163,25 +163,25 @@ pub fn await(fd: net::sock_t, deadline: Option<u64>, let mut set: c::fd_set = unsafe { mem::zeroed() }; c::fd_set(&mut set, fd); let (read, write) = match status { - Readable => (&set as *_, ptr::null()), - Writable => (ptr::null(), &set as *_), + Readable => (&mut set as *mut _, ptr::mut_null()), + Writable => (ptr::mut_null(), &mut set as *mut _), }; let mut tv: libc::timeval = unsafe { mem::zeroed() }; match retry(|| { let now = ::io::timer::now(); let tvp = match deadline { - None => ptr::null(), + None => ptr::mut_null(), Some(deadline) => { // If we're past the deadline, then pass a 0 timeout to // select() so we can poll the status let ms = if deadline < now {0} else {deadline - now}; tv = ms_to_timeval(ms); - &tv as *_ + &mut tv as *mut _ } }; let n = if cfg!(windows) {1} else {fd as libc::c_int + 1}; - let r = unsafe { c::select(n, read, write, ptr::null(), tvp) }; + let r = unsafe { c::select(n, read, write, ptr::mut_null(), tvp) }; r }) { -1 => Err(last_error()), |
