Skip to content

Commit

Permalink
Replaced 0 as *{const,mut} _ with std::ptr::null{,_mut}() for str…
Browse files Browse the repository at this point in the history
…ict provenance.
  • Loading branch information
kkysen committed Oct 10, 2022
1 parent e657818 commit 77a8271
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions analysis/test/src/pointers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub struct S {
pub field4: T,
}
#[no_mangle]
pub static mut global: *mut S = 0 as *const S as *mut S;
pub static mut global: *mut S = std::ptr::null_mut();
#[no_mangle]
pub unsafe extern "C" fn malloc_wrapper(mut size: size_t) -> *mut libc::c_void {
return malloc(size);
Expand Down Expand Up @@ -105,7 +105,7 @@ pub unsafe extern "C" fn simple() {
(*y).field4 = T {
field: 0i32,
field2: 0u64,
field3: 0 as *const S,
field3: std::ptr::null(),
field4: 0i32,
};
let s = *y;
Expand Down Expand Up @@ -232,7 +232,7 @@ pub unsafe extern "C" fn fdevent_unregister(mut ev: *mut fdevents, mut fd: libc:
return;
}
let ref mut fresh1 = *((*ev).fdarray).offset(fd as isize);
*fresh1 = 0 as *mut fdnode;
*fresh1 = std::ptr::null_mut();
fdnode_free(fdn);
}
unsafe extern "C" fn fdnode_free(mut fdn: *mut fdnode) {
Expand Down Expand Up @@ -345,7 +345,7 @@ pub unsafe extern "C" fn invalid() {
b"%i\n\x00" as *const u8 as *const libc::c_char,
(*global).field,
);
global = 0 as *mut S;
global = std::ptr::null_mut();
free(s as *mut libc::c_void);
}
pub unsafe extern "C" fn testing() {
Expand Down Expand Up @@ -416,14 +416,14 @@ pub unsafe extern "C" fn test_ref_field() {
let t = T {
field: 0i32,
field2: 0u64,
field3: 0 as *const S,
field3: std::ptr::null(),
field4: 0i32,
};

let ref mut s = S {
field: 0i32,
field2: 0u64,
field3: 0 as *const S,
field3: std::ptr::null(),
field4: t,
};
s.field4.field4 = s.field4.field4;
Expand Down

0 comments on commit 77a8271

Please sign in to comment.