diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 00:30:44 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 00:30:44 -0600 |
| commit | 5f92e02ff71be19067a422d324beb610cacd084d (patch) | |
| tree | 1af510b0e4b9e3de95b18f476a6ebff2f109c488 /src/main.c | |
| parent | 7a7320b6a0d7dd6864b708b7e74fb5032a5bdf8e (diff) | |
| download | zash-chore/c23-nullptr-constexpr.tar.gz | |
C23: nullptr for null pointers, constexpr for typed constantschore/c23-nullptr-constexpr
nullptr in every place a null pointer constant was meant; NULL is gone
from src/.
constexpr where it improves on #define without costing anything: the
IGGCSI00 work-area offsets and sizes, and the scalar sizes MVS_DSN_MAX,
CSI_FIELD_LEN, CSI_WORK_MIN, PDS_DIRBLK, CSI_WORK, CSI_MAX_CALLS. A
constexpr in C is a constant expression, so it still bounds the arrays
that use it, and it now carries a type and can be checked with
static_assert. Feature switches (#if), the CSIETYPE/EBCDIC byte
constants read as octets, and the related-constant enum sets stay as
they were.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -260,7 +260,7 @@ const char *shell_path(void) { path = full; } else { const char *search = var_get("PATH"); - char *found = search ? path_search(name, search, true) : NULL; + char *found = search ? path_search(name, search, true) : nullptr; path = found ? xstrdup(found) : "/bin/sh"; } return path; @@ -287,7 +287,7 @@ void exit_shell(int status) { code = exitstatus; /* the trap called exit itself */ } } - exc_handler = NULL; + exc_handler = nullptr; if (!in_subshell) { interact_exit(); jc_exit(); @@ -407,8 +407,8 @@ static void usage_print(output *o, bool full) { */ int main(int argc, char **argv) { jmploc jl; - const char *volatile script = NULL; - const char *volatile command = NULL; + const char *volatile script = nullptr; + const char *volatile command = nullptr; volatile bool in_args = false; /* read after longjmp: must be volatile */ bool ignored = false; @@ -459,7 +459,7 @@ int main(int argc, char **argv) { arg0 = script; } in_args = false; - shellparam = (shparam){argc - i, argv + i, NULL}; + shellparam = (shparam){argc - i, argv + i, nullptr}; if (!command && !script) { opt.stdin_cmds = true; |
