Skip to content

Commit 4dd8b2c

Browse files
committed
Use proper way to return null pointer
1 parent d9aaae0 commit 4dd8b2c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub unsafe extern "C" fn malloc(len: usize) -> *mut c_void {
5353
0,
5454
);
5555
if ptr == libc::MAP_FAILED {
56-
libc::PT_NULL as *mut libc::c_void
56+
ptr::null_mut()
5757
} else {
5858
// This is guaranteed to be aligned
5959
*(ptr as *mut usize) = full_len;
@@ -83,7 +83,7 @@ pub unsafe extern "C" fn calloc(n_items: usize, item_len: usize) -> *mut c_void
8383
0,
8484
);
8585
if ptr == libc::MAP_FAILED {
86-
libc::PT_NULL as *mut libc::c_void
86+
ptr::null_mut()
8787
} else {
8888
// This is guaranteed to be aligned
8989
*(ptr as *mut usize) = full_len;

0 commit comments

Comments
 (0)