diff options
| author | we <vadim.petrochenkov@gmail.com> | 2015-01-19 08:27:09 +0300 |
|---|---|---|
| committer | we <vadim.petrochenkov@gmail.com> | 2015-01-19 08:27:09 +0300 |
| commit | 2c2480df5d340f4c7b2deeef0177e4fd22f2b03a (patch) | |
| tree | 0661dc5e07b8142ad1ca02ff4be9320ceaa6b3ba /src/libstd/sync/mpsc/select.rs | |
| parent | 378fb5846d2d8dbc5ab24a5e92794c5c39d492dc (diff) | |
| download | rust-2c2480df5d340f4c7b2deeef0177e4fd22f2b03a.tar.gz rust-2c2480df5d340f4c7b2deeef0177e4fd22f2b03a.zip | |
Replace `0 as *const/mut T` with `ptr::null/null_mut()`
Diffstat (limited to 'src/libstd/sync/mpsc/select.rs')
| -rw-r--r-- | src/libstd/sync/mpsc/select.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 62a7b823ec8..3331411eee7 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -59,6 +59,7 @@ use core::prelude::*; use core::cell::Cell; use core::marker; use core::mem; +use core::ptr; use core::uint; use sync::mpsc::{Receiver, RecvError}; @@ -130,8 +131,8 @@ impl Select { pub fn new() -> Select { Select { marker1: marker::NoSend, - head: 0 as *mut Handle<'static, ()>, - tail: 0 as *mut Handle<'static, ()>, + head: ptr::null_mut(), + tail: ptr::null_mut(), next_id: Cell::new(1), } } @@ -144,8 +145,8 @@ impl Select { #[cfg(not(stage0))] // NOTE remove cfg after next snapshot pub fn new() -> Select { Select { - head: 0 as *mut Handle<'static, ()>, - tail: 0 as *mut Handle<'static, ()>, + head: ptr::null_mut(), + tail: ptr::null_mut(), next_id: Cell::new(1), } } @@ -159,8 +160,8 @@ impl Select { Handle { id: id, selector: self, - next: 0 as *mut Handle<'static, ()>, - prev: 0 as *mut Handle<'static, ()>, + next: ptr::null_mut(), + prev: ptr::null_mut(), added: false, rx: rx, packet: rx, @@ -325,8 +326,8 @@ impl<'rx, T: Send> Handle<'rx, T> { (*self.next).prev = self.prev; } - self.next = 0 as *mut Handle<'static, ()>; - self.prev = 0 as *mut Handle<'static, ()>; + self.next = ptr::null_mut(); + self.prev = ptr::null_mut(); self.added = false; } |
