Rename some constants to UPPER_CASE

This commit is contained in:
Peter Ammon
2025-10-26 11:28:04 -07:00
parent 15d06f964d
commit 95e7977e70
2 changed files with 6 additions and 6 deletions

View File

@@ -397,12 +397,12 @@ fn safe_launch_process(
if err.0 == ENOEXEC && is_thompson_shell_script(actual_cmd) {
// Construct new argv.
// We must not allocate memory, so only 128 args are supported.
const maxargs: usize = 128;
const MAXARGS: usize = 128;
let nargs = argv.len();
let argv = unsafe { slice::from_raw_parts(argv.get(), nargs) };
if nargs <= maxargs {
if nargs <= MAXARGS {
// +1 for /bin/sh, +1 for terminating nullptr
let mut argv2 = [std::ptr::null(); 1 + maxargs + 1];
let mut argv2 = [std::ptr::null(); 1 + MAXARGS + 1];
let bshell = PATH_BSHELL.as_ptr() as *const c_char;
argv2[0] = bshell as *mut c_char;
argv2[1..argv.len() + 1].copy_from_slice(argv);

View File

@@ -1181,13 +1181,13 @@ fn format_history_record(
let mut timestamp = MaybeUninit::uninit();
if let Some(show_time_format) = show_time_format.and_then(|s| CString::new(s).ok()) {
if !unsafe { libc::localtime_r(&seconds, timestamp.as_mut_ptr()).is_null() } {
const max_tstamp_length: usize = 100;
let mut timestamp_str = [0_u8; max_tstamp_length];
const MAX_TIMESTAMP_LENGTH: usize = 100;
let mut timestamp_str = [0_u8; MAX_TIMESTAMP_LENGTH];
use libc::strftime;
if unsafe {
strftime(
&mut timestamp_str[0] as *mut u8 as *mut libc::c_char,
max_tstamp_length,
MAX_TIMESTAMP_LENGTH,
show_time_format.as_ptr(),
timestamp.as_ptr(),
)