Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3076,9 +3076,9 @@ f! {

pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
if ((*cmsg).cmsg_len as size_t) < size_of::<cmsghdr>() {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else if __CMSG_NEXT(cmsg).add(size_of::<cmsghdr>()) >= __MHDR_END(mhdr) {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
__CMSG_NEXT(cmsg).cast()
}
Expand All @@ -3088,7 +3088,7 @@ f! {
if (*mhdr).msg_controllen as size_t >= size_of::<cmsghdr>() {
(*mhdr).msg_control.cast()
} else {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/new/qurt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub const FOPEN_MAX: c_uint = 20;
pub const EOK: c_int = 0;

// Semaphore constants
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
pub const SEM_FAILED: *mut sem_t = ptr::null_mut();

// Page size constants (hexagon-specific)
pub const PAGESIZE: size_t = 4096;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,7 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
(*mhdr).msg_control as *mut cmsghdr
} else {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
}
}

Expand All @@ -2426,7 +2426,7 @@ f! {
if (cmsg as usize + (*cmsg).cmsg_len as usize + size_of::<cmsghdr>())
> ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize)
{
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
// AIX does not have any alignment/padding for ancillary data, so we don't need _CMSG_ALIGN here.
(cmsg as usize + (*cmsg).cmsg_len as usize) as *mut cmsghdr
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4068,7 +4068,7 @@ f! {
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len);
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next + __DARWIN_ALIGN32(size_of::<cmsghdr>()) > max {
core::ptr::null_mut()
ptr::null_mut()
} else {
next as *mut cmsghdr
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ f! {
if next <= max {
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
} else {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4198,7 +4198,7 @@ f! {
let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(size_of::<cmsghdr>());
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next > max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
(cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
(*mhdr).msg_control.cast::<cmsghdr>()
} else {
core::ptr::null_mut()
ptr::null_mut()
}
}

Expand Down
28 changes: 14 additions & 14 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,42 +1330,42 @@ cfg_if! {
ptm_pad1: Padding::new([0; 3]),
ptm_unused: Padding::new(0),
ptm_pad2: Padding::new([0; 3]),
ptm_waiters: 0 as *mut _,
ptm_waiters: ptr::null_mut(),
ptm_owner: 0,
ptm_recursed: 0,
ptm_spare2: 0 as *mut _,
ptm_spare2: ptr::null_mut(),
};
} else {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
ptm_magic: 0x33330003,
ptm_errorcheck: 0,
ptm_unused: Padding::new(0),
ptm_waiters: 0 as *mut _,
ptm_waiters: ptr::null_mut(),
ptm_owner: 0,
ptm_recursed: 0,
ptm_spare2: 0 as *mut _,
ptm_spare2: ptr::null_mut(),
};
}
}

pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
ptc_magic: 0x55550005,
ptc_lock: 0,
ptc_waiters_first: 0 as *mut _,
ptc_waiters_last: 0 as *mut _,
ptc_mutex: 0 as *mut _,
ptc_private: 0 as *mut _,
ptc_waiters_first: ptr::null_mut(),
ptc_waiters_last: ptr::null_mut(),
ptc_mutex: ptr::null_mut(),
ptc_private: ptr::null_mut(),
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
ptr_magic: 0x99990009,
ptr_interlock: 0,
ptr_rblocked_first: 0 as *mut _,
ptr_rblocked_last: 0 as *mut _,
ptr_wblocked_first: 0 as *mut _,
ptr_wblocked_last: 0 as *mut _,
ptr_rblocked_first: ptr::null_mut(),
ptr_rblocked_last: ptr::null_mut(),
ptr_wblocked_first: ptr::null_mut(),
ptr_wblocked_last: ptr::null_mut(),
ptr_nreaders: 0,
ptr_owner: 0,
ptr_private: 0 as *mut _,
ptr_private: ptr::null_mut(),
};
pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
Expand Down Expand Up @@ -1824,7 +1824,7 @@ f! {
let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(size_of::<cmsghdr>());
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next > max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
(cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,7 @@ f! {
let next = cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize) + _ALIGN(size_of::<cmsghdr>());
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next > max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
(cmsg as usize + _ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
}
Expand Down
6 changes: 3 additions & 3 deletions src/unix/cygwin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ pub const LC_TIME_MASK: c_int = 1 << 5;
pub const LC_MESSAGES_MASK: c_int = 1 << 6;
pub const LC_GLOBAL_LOCALE: locale_t = -1isize as locale_t;

pub const SEM_FAILED: *mut sem_t = core::ptr::null_mut();
pub const SEM_FAILED: *mut sem_t = ptr::null_mut();

pub const ST_RDONLY: c_ulong = 0x80000;
pub const ST_NOSUID: c_ulong = 0;
Expand Down Expand Up @@ -1759,15 +1759,15 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
(*mhdr).msg_control.cast()
} else {
core::ptr::null_mut()
ptr::null_mut()
}
}

pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
let next = (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next as usize + CMSG_ALIGN(size_of::<cmsghdr>()) as usize > max {
core::ptr::null_mut()
ptr::null_mut()
} else {
next
}
Expand Down
8 changes: 4 additions & 4 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
flags: 0,
unused: Padding::new(0),
mutex: 0 as *mut _,
mutex: ptr::null_mut(),
waiter_count: 0,
lock: 0,
};
Expand All @@ -1108,7 +1108,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
lock_count: 0,
reader_count: 0,
writer_count: 0,
waiters: [0 as *mut _; 2],
waiters: [ptr::null_mut(); 2],
};

pub const PTHREAD_MUTEX_DEFAULT: c_int = 0;
Expand Down Expand Up @@ -1385,7 +1385,7 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
(*mhdr).msg_control as *mut cmsghdr
} else {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
}
}

Expand All @@ -1410,7 +1410,7 @@ f! {
+ CMSG_ALIGN(size_of::<cmsghdr>());
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if next > max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
(cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/haiku/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ pub const B_XATTR_TYPE: u32 = haiku_constant!('X', 'A', 'T', 'R');
pub const B_NETWORK_ADDRESS_TYPE: u32 = haiku_constant!('N', 'W', 'A', 'D');
pub const B_MIME_STRING_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'S');
pub const B_ASCII_TYPE: u32 = haiku_constant!('T', 'E', 'X', 'T');
pub const B_APP_IMAGE_SYMBOL: *const c_void = core::ptr::null();
pub const B_APP_IMAGE_SYMBOL: *const c_void = ptr::null();

extern "C" {
// kernel/OS.h
Expand Down
20 changes: 10 additions & 10 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3336,19 +3336,19 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__lock: __PTHREAD_SPIN_LOCK_INITIALIZER,
__queue: 0i64 as *mut __pthread,
__attr: 0i64 as *mut __pthread_condattr,
__queue: ptr::null_mut(),
__attr: ptr::null_mut(),
__wrefs: 0,
__data: 0i64 as *mut c_void,
__data: ptr::null_mut(),
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__held: __PTHREAD_SPIN_LOCK_INITIALIZER,
__lock: __PTHREAD_SPIN_LOCK_INITIALIZER,
__readers: 0,
__readerqueue: 0i64 as *mut __pthread,
__writerqueue: 0i64 as *mut __pthread,
__attr: 0i64 as *mut __pthread_rwlockattr,
__data: 0i64 as *mut c_void,
__readerqueue: ptr::null_mut(),
__writerqueue: ptr::null_mut(),
__attr: ptr::null_mut(),
__data: ptr::null_mut(),
};
pub const PTHREAD_STACK_MIN: size_t = 0;

Expand All @@ -3365,7 +3365,7 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
(*mhdr).msg_control.cast::<cmsghdr>()
} else {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
}
}

Expand All @@ -3383,14 +3383,14 @@ f! {

pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
if ((*cmsg).cmsg_len as usize) < size_of::<cmsghdr>() {
return core::ptr::null_mut::<cmsghdr>();
return ptr::null_mut();
}
let next = (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if (next.offset(1)) as usize > max
|| next as usize + CMSG_ALIGN((*next).cmsg_len as usize) > max
{
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
next.cast::<cmsghdr>()
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3283,7 +3283,7 @@ f! {
let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if (next.offset(1)) as usize > max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
next as *mut cmsghdr
}
Expand Down
4 changes: 2 additions & 2 deletions src/unix/linux_like/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,12 +1253,12 @@ pub const SOMAXCONN: c_int = 128;
f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
if ((*cmsg).cmsg_len as usize) < size_of::<cmsghdr>() {
return core::ptr::null_mut::<cmsghdr>();
return ptr::null_mut();
}
let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
if (next.offset(1)) as usize >= max {
core::ptr::null_mut::<cmsghdr>()
ptr::null_mut()
} else {
next as *mut cmsghdr
}
Expand Down
10 changes: 5 additions & 5 deletions src/unix/linux_like/l4re/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ pub const __LOCK_INITIALIZER: _pthread_fastlock = _pthread_fastlock {
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__m_reserved: 0,
__m_count: 0,
__m_owner: core::ptr::null_mut(),
__m_owner: ptr::null_mut(),
__m_kind: PTHREAD_MUTEX_TIMED_NP,
__m_lock: __LOCK_INITIALIZER,
};
Expand All @@ -468,17 +468,17 @@ const PTHREAD_COND_PADDING_SIZE: usize = 48

pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__c_lock: __LOCK_INITIALIZER,
__c_waiting: core::ptr::null_mut(),
__c_waiting: ptr::null_mut(),
__padding: [0; PTHREAD_COND_PADDING_SIZE],
__align: 0,
};

pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__rw_lock: __LOCK_INITIALIZER,
__rw_readers: 0,
__rw_writer: core::ptr::null_mut(),
__rw_read_waiting: core::ptr::null_mut(),
__rw_write_waiting: core::ptr::null_mut(),
__rw_writer: ptr::null_mut(),
__rw_read_waiting: ptr::null_mut(),
__rw_write_waiting: ptr::null_mut(),
__rw_kind: PTHREAD_RWLOCK_DEFAULT_NP,
__rw_pshared: crate::PTHREAD_PROCESS_PRIVATE,
};
Expand Down
6 changes: 3 additions & 3 deletions src/unix/linux_like/linux_l4re_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ f! {
cmsg: *const crate::cmsghdr,
) -> *mut crate::cmsghdr {
if ((*cmsg).cmsg_len as usize) < size_of::<crate::cmsghdr>() {
return core::ptr::null_mut::<crate::cmsghdr>();
return ptr::null_mut();
}

// FIXME(msrv): `.wrapping_byte_add()` stabilized in 1.75
Expand All @@ -1497,7 +1497,7 @@ f! {
// In case the addition wrapped. `next_addr > max_addr`
// would otherwise not work as intended.
if (next_cmsg as usize) < (cmsg as usize) {
return core::ptr::null_mut();
return ptr::null_mut();
}

let mut max_addr = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
Expand All @@ -1510,7 +1510,7 @@ f! {
}

if next_cmsg as usize + size_of::<crate::cmsghdr>() > max_addr {
core::ptr::null_mut::<crate::cmsghdr>()
ptr::null_mut()
} else {
next_cmsg as *mut crate::cmsghdr
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ f! {
if (*mhdr).msg_controllen as usize >= size_of::<crate::cmsghdr>() {
(*mhdr).msg_control.cast::<crate::cmsghdr>()
} else {
core::ptr::null_mut::<crate::cmsghdr>()
ptr::null_mut()
}
}

Expand Down
Loading