Change 'NULL' to 'null'
This commit is contained in:
parent
e10cbc33c1
commit
6679f5ceb1
37 changed files with 75 additions and 75 deletions
|
@ -498,7 +498,7 @@ impl CString {
|
|||
/// Failure to call [`CString::from_raw`] will lead to a memory leak.
|
||||
///
|
||||
/// The C side must **not** modify the length of the string (by writing a
|
||||
/// `NULL` somewhere inside the string or removing the final one) before
|
||||
/// `null` somewhere inside the string or removing the final one) before
|
||||
/// it makes it back into Rust using [`CString::from_raw`]. See the safety section
|
||||
/// in [`CString::from_raw`].
|
||||
///
|
||||
|
|
|
@ -49,7 +49,7 @@ pub(super) fn recv_vectored_with_ancillary_from(
|
|||
msg.msg_controllen = ancillary.buffer.len() as libc::socklen_t;
|
||||
}
|
||||
}
|
||||
// macos requires that the control pointer is NULL when the len is 0.
|
||||
// macos requires that the control pointer is null when the len is 0.
|
||||
if msg.msg_controllen > 0 {
|
||||
msg.msg_control = ancillary.buffer.as_mut_ptr().cast();
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ pub(super) fn send_vectored_with_ancillary_to(
|
|||
msg.msg_controllen = ancillary.length as libc::socklen_t;
|
||||
}
|
||||
}
|
||||
// macos requires that the control pointer is NULL when the len is 0.
|
||||
// macos requires that the control pointer is null when the len is 0.
|
||||
if msg.msg_controllen > 0 {
|
||||
msg.msg_control = ancillary.buffer.as_mut_ptr().cast();
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ cfg_has_statx! {{
|
|||
|
||||
match STATX_STATE.load(Ordering::Relaxed) {
|
||||
0 => {
|
||||
// It is a trick to call `statx` with NULL pointers to check if the syscall
|
||||
// It is a trick to call `statx` with null pointers to check if the syscall
|
||||
// is available. According to the manual, it is expected to fail with EFAULT.
|
||||
// We do this mainly for performance, since it is nearly hundreds times
|
||||
// faster than a normal successful call.
|
||||
|
@ -450,7 +450,7 @@ impl Iterator for ReadDir {
|
|||
super::os::set_errno(0);
|
||||
let entry_ptr = libc::readdir(self.inner.dirp.0);
|
||||
if entry_ptr.is_null() {
|
||||
// NULL can mean either the end is reached or an error occurred.
|
||||
// null can mean either the end is reached or an error occurred.
|
||||
// So we had to clear errno beforehand to check for an error now.
|
||||
return match super::os::errno() {
|
||||
0 => None,
|
||||
|
|
|
@ -153,7 +153,7 @@ impl Command {
|
|||
}
|
||||
|
||||
pub fn arg(&mut self, arg: &OsStr) {
|
||||
// Overwrite the trailing NULL pointer in `argv` and then add a new null
|
||||
// Overwrite the trailing null pointer in `argv` and then add a new null
|
||||
// pointer.
|
||||
let arg = os2c(arg, &mut self.saw_nul);
|
||||
self.argv.0[self.args.len()] = arg.as_ptr();
|
||||
|
|
|
@ -722,7 +722,7 @@ pub mod os {
|
|||
unsafe extern "C" fn destroy_value<T: 'static>(ptr: *mut u8) {
|
||||
// SAFETY:
|
||||
//
|
||||
// The OS TLS ensures that this key contains a NULL value when this
|
||||
// The OS TLS ensures that this key contains a null value when this
|
||||
// destructor starts to run. We set it back to a sentinel value of 1 to
|
||||
// ensure that any future calls to `get` for this thread will return
|
||||
// `None`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue