diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-01-10 12:52:00 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-01-10 12:52:00 +0000 |
| commit | cd9a73d2ea4ca9452e3471d7e6c04af14eb1c2ed (patch) | |
| tree | 9cc6c46767976077aa615a3c8311a72201fbf376 /src/libstd/sys/vxworks | |
| parent | 2d8d559bbecf6272eb41f8a800e319238aa9d621 (diff) | |
| download | rust-cd9a73d2ea4ca9452e3471d7e6c04af14eb1c2ed.tar.gz rust-cd9a73d2ea4ca9452e3471d7e6c04af14eb1c2ed.zip | |
make use of pointer::is_null
Diffstat (limited to 'src/libstd/sys/vxworks')
| -rw-r--r-- | src/libstd/sys/vxworks/os.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libstd/sys/vxworks/os.rs b/src/libstd/sys/vxworks/os.rs index d4219154499..1fadf716135 100644 --- a/src/libstd/sys/vxworks/os.rs +++ b/src/libstd/sys/vxworks/os.rs @@ -7,7 +7,6 @@ use crate::marker::PhantomData; use crate::mem; use crate::memchr; use crate::path::{self, Path, PathBuf}; -use crate::ptr; use crate::slice; use crate::str; use crate::sys::cvt; @@ -226,15 +225,15 @@ pub fn env() -> Env { unsafe { let _guard = env_lock(); let mut environ = *environ(); - if environ == ptr::null() { + if environ.is_null() { panic!("os::env() failure getting env string from OS: {}", io::Error::last_os_error()); } let mut result = Vec::new(); - while *environ != ptr::null() { + while !(*environ).is_null() { if let Some(key_value) = parse(CStr::from_ptr(*environ).to_bytes()) { result.push(key_value); } - environ = environ.offset(1); + environ = environ.add(1); } return Env { iter: result.into_iter(), _dont_send_or_sync_me: PhantomData }; } |
