Skip to content

Commit

Permalink
use appropriate null pointer constructor instead of casting
Browse files Browse the repository at this point in the history
  • Loading branch information
cagatay-y committed Oct 25, 2023
1 parent 64ea080 commit 4c677ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub(crate) extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
"__sys_malloc called with size {:#x}, align {:#x} is an invalid layout!",
size, align
);
return core::ptr::null::<*mut u8>() as *mut u8;
return core::ptr::null_mut();
}
let layout = layout_res.unwrap();
let ptr = unsafe { ALLOCATOR.alloc(layout) };
Expand Down Expand Up @@ -185,7 +185,7 @@ pub(crate) extern "C" fn __sys_realloc(
"__sys_realloc called with ptr {:p}, size {:#x}, align {:#x}, new_size {:#x} is an invalid layout!",
ptr, size, align, new_size
);
return core::ptr::null::<*mut u8>() as *mut u8;
return core::ptr::null_mut();
}
let layout = layout_res.unwrap();
let new_ptr = ALLOCATOR.realloc(ptr, layout, new_size);
Expand Down

0 comments on commit 4c677ad

Please sign in to comment.