diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-09-03 09:49:50 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-09-03 09:49:50 +0300 |
| commit | 06fb196256bbab1e7aa4f43daf45321efaa6e0eb (patch) | |
| tree | 23863826af019b2bc07d295882e092d244c36699 /src/libstd/rt | |
| parent | 3903ea96f557dc923cf73d3905554083cd921a01 (diff) | |
| download | rust-06fb196256bbab1e7aa4f43daf45321efaa6e0eb.tar.gz rust-06fb196256bbab1e7aa4f43daf45321efaa6e0eb.zip | |
Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/at_exit_imp.rs | 3 | ||||
| -rw-r--r-- | src/libstd/rt/unwind/seh.rs | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs index 17d2940a6f1..54e5b499e53 100644 --- a/src/libstd/rt/at_exit_imp.rs +++ b/src/libstd/rt/at_exit_imp.rs @@ -18,6 +18,7 @@ use alloc::boxed::FnBox; use boxed::Box; +use ptr; use sys_common::mutex::Mutex; use vec::Vec; @@ -28,7 +29,7 @@ type Queue = Vec<Box<FnBox()>>; // the thread infrastructure to be in place (useful on the borders of // initialization/destruction). static LOCK: Mutex = Mutex::new(); -static mut QUEUE: *mut Queue = 0 as *mut Queue; +static mut QUEUE: *mut Queue = ptr::null_mut(); // The maximum number of times the cleanup routines will be run. While running // the at_exit closures new ones may be registered, and this count is the number diff --git a/src/libstd/rt/unwind/seh.rs b/src/libstd/rt/unwind/seh.rs index ed44f9a8bda..8c793758166 100644 --- a/src/libstd/rt/unwind/seh.rs +++ b/src/libstd/rt/unwind/seh.rs @@ -53,6 +53,7 @@ use prelude::v1::*; use any::Any; use libc::{c_ulong, DWORD, c_void}; +use ptr; use sys_common::thread_local::StaticKey; // 0x R U S T @@ -98,7 +99,7 @@ pub unsafe fn panic(data: Box<Any + Send + 'static>) -> ! { rtassert!(PANIC_DATA.get().is_null()); PANIC_DATA.set(Box::into_raw(exception) as *mut u8); - RaiseException(RUST_PANIC, 0, 0, 0 as *const _); + RaiseException(RUST_PANIC, 0, 0, ptr::null()); rtabort!("could not unwind stack"); } @@ -108,7 +109,7 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box<Any + Send + 'static> { rtassert!(ptr as DWORD == RUST_PANIC); let data = PANIC_DATA.get() as *mut Box<Any + Send + 'static>; - PANIC_DATA.set(0 as *mut u8); + PANIC_DATA.set(ptr::null_mut()); rtassert!(!data.is_null()); *Box::from_raw(data) |
