From 434d29c8f822680039dfcde8d168eb2167e10204 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 31 Aug 2019 02:24:30 +0900 Subject: [PATCH] Use ptr::null_mut instead of 0 as *mut (#84) --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 946ce5b..d13ea3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,6 +267,8 @@ fn get_num_cpus() -> usize { target_os = "dragonfly", target_os = "netbsd"))] fn get_num_cpus() -> usize { + use std::ptr; + let mut cpus: libc::c_uint = 0; let mut cpus_size = std::mem::size_of_val(&cpus); @@ -280,7 +282,7 @@ fn get_num_cpus() -> usize { 2, &mut cpus as *mut _ as *mut _, &mut cpus_size as *mut _ as *mut _, - 0 as *mut _, + ptr::null_mut(), 0); } if cpus < 1 { @@ -292,6 +294,8 @@ fn get_num_cpus() -> usize { #[cfg(target_os = "openbsd")] fn get_num_cpus() -> usize { + use std::ptr; + let mut cpus: libc::c_uint = 0; let mut cpus_size = std::mem::size_of_val(&cpus); let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0]; @@ -301,7 +305,7 @@ fn get_num_cpus() -> usize { 2, &mut cpus as *mut _ as *mut _, &mut cpus_size as *mut _ as *mut _, - 0 as *mut _, + ptr::null_mut(), 0); } if cpus < 1 {