diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-02-13 09:46:46 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-02-19 16:35:31 -0800 |
| commit | 33923f47e3f90442ae3c604d8ea80992b71611f7 (patch) | |
| tree | 4130c674d6114c3b6a7399b599e98cf62fca3aac /src/libnative | |
| parent | ea0058281cfea06a61e5eb23b31c15e9d1dcfda3 (diff) | |
| download | rust-33923f47e3f90442ae3c604d8ea80992b71611f7.tar.gz rust-33923f47e3f90442ae3c604d8ea80992b71611f7.zip | |
librustc: Remove unique vector patterns from the language.
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/timer_other.rs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/libnative/io/timer_other.rs b/src/libnative/io/timer_other.rs index a06cab33a52..e20c017c4b5 100644 --- a/src/libnative/io/timer_other.rs +++ b/src/libnative/io/timer_other.rs @@ -130,27 +130,25 @@ fn helper(input: libc::c_int, messages: Port<Req>) { } 'outer: loop { - let timeout = match active { + let timeout = if active.len() == 0 { // Empty array? no timeout (wait forever for the next request) - [] => ptr::null(), - - [~Inner { target, .. }, ..] => { - let now = now(); - // If this request has already expired, then signal it and go - // through another iteration - if target <= now { - signal(&mut active, &mut dead); - continue; - } - - // The actual timeout listed in the requests array is an - // absolute date, so here we translate the absolute time to a - // relative time. - let tm = target - now; - timeout.tv_sec = (tm / 1000) as libc::time_t; - timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t; - &timeout as *libc::timeval + ptr::null() + } else { + let now = now(); + // If this request has already expired, then signal it and go + // through another iteration + if active[0].target <= now { + signal(&mut active, &mut dead); + continue; } + + // The actual timeout listed in the requests array is an + // absolute date, so here we translate the absolute time to a + // relative time. + let tm = active[0].target - now; + timeout.tv_sec = (tm / 1000) as libc::time_t; + timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t; + &timeout as *libc::timeval }; imp::fd_set(&mut set, input); |
