diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 09:18:07 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 09:18:07 -0800 |
| commit | 907db6c8344a4df070ee2b21479062a63c3ae2be (patch) | |
| tree | b4950d1359d2d30a866039946cf4ff96ba8d6019 /src/libstd/sys | |
| parent | b5de8333b3ef29fe3d0952d9207fd275c45da9f2 (diff) | |
| parent | 2c2480df5d340f4c7b2deeef0177e4fd22f2b03a (diff) | |
| download | rust-907db6c8344a4df070ee2b21479062a63c3ae2be.tar.gz rust-907db6c8344a4df070ee2b21479062a63c3ae2be.zip | |
rollup merge of #21444: petrochenkov/null
Conflicts: src/libstd/sync/mpsc/select.rs
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/helper_thread.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/backtrace.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/condvar.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/process.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/backtrace.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sys/windows/thread_local.rs | 4 |
8 files changed, 16 insertions, 13 deletions
diff --git a/src/libstd/sys/common/helper_thread.rs b/src/libstd/sys/common/helper_thread.rs index f940b6ed368..6f6179a436e 100644 --- a/src/libstd/sys/common/helper_thread.rs +++ b/src/libstd/sys/common/helper_thread.rs @@ -24,6 +24,7 @@ use prelude::v1::*; use cell::UnsafeCell; use mem; +use ptr; use rt; use sync::{StaticMutex, StaticCondvar}; use sync::mpsc::{channel, Sender, Receiver}; @@ -132,7 +133,7 @@ impl<M: Send> Helper<M> { // Close the channel by destroying it let chan: Box<Sender<M>> = mem::transmute(*self.chan.get()); - *self.chan.get() = 0 as *mut Sender<M>; + *self.chan.get() = ptr::null_mut(); drop(chan); helper_signal::signal(*self.signal.get() as helper_signal::signal); diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs index e6007a4d43c..cb2edf50ebd 100644 --- a/src/libstd/sys/unix/backtrace.rs +++ b/src/libstd/sys/unix/backtrace.rs @@ -353,7 +353,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> { if state.is_null() { return output(w, idx, addr, None) } - let mut data = 0 as *const libc::c_char; + let mut data = ptr::null(); let data_addr = &mut data as *mut *const libc::c_char; let ret = unsafe { backtrace_syminfo(state, addr as libc::uintptr_t, diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 85a65bbef50..3bc41473152 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -10,6 +10,7 @@ use cell::UnsafeCell; use libc; +use ptr; use std::option::Option::{Some, None}; use sys::mutex::{self, Mutex}; use sys::time; @@ -62,7 +63,7 @@ impl Condvar { // time. let mut sys_now = libc::timeval { tv_sec: 0, tv_usec: 0 }; let stable_now = time::SteadyTime::now(); - let r = ffi::gettimeofday(&mut sys_now, 0 as *mut _); + let r = ffi::gettimeofday(&mut sys_now, ptr::null_mut()); debug_assert_eq!(r, 0); let seconds = NumCast::from(dur.num_seconds()); diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index c53f9d22790..dd478347f81 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -19,6 +19,7 @@ use io::{Read, Truncate, SeekCur, SeekSet, ReadWrite, SeekEnd, Append}; use io; use libc::{self, c_int, c_void}; use mem; +use ptr; use sys::retry; use sys_common::{keep_going, eof, mkerr_libc}; @@ -207,7 +208,7 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> { if dir_ptr as uint != 0 { let mut paths = vec!(); - let mut entry_ptr = 0 as *mut dirent_t; + let mut entry_ptr = ptr::null_mut(); while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } { if entry_ptr.is_null() { break } paths.push(unsafe { diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 175c4e2e353..2c25af055ee 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -143,7 +143,7 @@ pub unsafe fn get_env_pairs() -> Vec<Vec<u8>> { os::last_os_error()); } let mut result = Vec::new(); - while *environ != 0 as *const _ { + while *environ != ptr::null() { let env_pair = ffi::c_str_to_bytes(&*environ).to_vec(); result.push(env_pair); environ = environ.offset(1); diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index 36bf696dba5..0eab27de43a 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -251,7 +251,7 @@ impl Process { fn setgroups(ngroups: libc::c_int, ptr: *const libc::c_void) -> libc::c_int; } - let _ = setgroups(0, 0 as *const libc::c_void); + let _ = setgroups(0, ptr::null()); if libc::setuid(u as libc::uid_t) != 0 { fail(&mut output); diff --git a/src/libstd/sys/windows/backtrace.rs b/src/libstd/sys/windows/backtrace.rs index 03a23214cf3..2561b1bebb5 100644 --- a/src/libstd/sys/windows/backtrace.rs +++ b/src/libstd/sys/windows/backtrace.rs @@ -327,7 +327,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> { let image = arch::init_frame(&mut frame, &context); // Initialize this process's symbols - let ret = SymInitialize(process, 0 as *mut libc::c_void, libc::TRUE); + let ret = SymInitialize(process, ptr::null_mut(), libc::TRUE); if ret != libc::TRUE { return Ok(()) } let _c = Cleanup { handle: process, SymCleanup: SymCleanup }; @@ -335,10 +335,10 @@ pub fn write(w: &mut Writer) -> IoResult<()> { let mut i = 0i; try!(write!(w, "stack backtrace:\n")); while StackWalk64(image, process, thread, &mut frame, &mut context, - 0 as *mut libc::c_void, - 0 as *mut libc::c_void, - 0 as *mut libc::c_void, - 0 as *mut libc::c_void) == libc::TRUE{ + ptr::null_mut(), + ptr::null_mut(), + ptr::null_mut(), + ptr::null_mut()) == libc::TRUE{ let addr = frame.AddrPC.Offset; if addr == frame.AddrReturn.Offset || addr == 0 || frame.AddrReturn.Offset == 0 { break } diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index d371023f218..83c116e9b05 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -137,7 +137,7 @@ unsafe fn init_dtors() { rt::at_exit(move|| { DTOR_LOCK.lock(); let dtors = DTORS; - DTORS = 0 as *mut _; + DTORS = ptr::null_mut(); mem::transmute::<_, Box<Vec<(Key, Dtor)>>>(dtors); assert!(DTORS.is_null()); // can't re-init after destructing DTOR_LOCK.unlock(); @@ -250,7 +250,7 @@ unsafe fn run_dtors() { for &(key, dtor) in dtors.iter() { let ptr = TlsGetValue(key); if !ptr.is_null() { - TlsSetValue(key, 0 as *mut _); + TlsSetValue(key, ptr::null_mut()); dtor(ptr as *mut _); any_run = true; } |
