From 06fb196256bbab1e7aa4f43daf45321efaa6e0eb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 3 Sep 2015 09:49:50 +0300 Subject: Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T` --- src/libstd/rt/at_exit_imp.rs | 3 ++- src/libstd/rt/unwind/seh.rs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libstd/rt') 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>; // 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) -> ! { 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 { rtassert!(ptr as DWORD == RUST_PANIC); let data = PANIC_DATA.get() as *mut Box; - PANIC_DATA.set(0 as *mut u8); + PANIC_DATA.set(ptr::null_mut()); rtassert!(!data.is_null()); *Box::from_raw(data) -- cgit 1.4.1-3-g733a5