summaryrefslogtreecommitdiffhomepage
path: root/src/sys_posix.c
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 00:30:44 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 00:30:44 -0600
commit5f92e02ff71be19067a422d324beb610cacd084d (patch)
tree1af510b0e4b9e3de95b18f476a6ebff2f109c488 /src/sys_posix.c
parent7a7320b6a0d7dd6864b708b7e74fb5032a5bdf8e (diff)
downloadzash-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/sys_posix.c')
-rw-r--r--src/sys_posix.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sys_posix.c b/src/sys_posix.c
index ba171b0..92f2d42 100644
--- a/src/sys_posix.c
+++ b/src/sys_posix.c
@@ -156,8 +156,8 @@ pid_t sys_spawn(const spawn_req *rq) {
}
posix_spawnattr_setflags(&attr, flags);
}
- rc = posix_spawn(&pid, rq->path, need_fa ? &fa : NULL,
- need_attr ? &attr : NULL, rq->argv, rq->envp);
+ rc = posix_spawn(&pid, rq->path, need_fa ? &fa : nullptr,
+ need_attr ? &attr : nullptr, rq->argv, rq->envp);
if (need_fa)
posix_spawn_file_actions_destroy(&fa);
if (need_attr)
@@ -285,11 +285,11 @@ int sys_tag_set(const char *path, const char *codeset, int text) {
/**
* @brief System facts. None of the z/OS ones exist here.
- * @return NULL: the ZOS_* variables are not defined on this platform.
+ * @return nullptr: the ZOS_* variables are not defined on this platform.
*/
const char *sys_info(sys_info_kind kind) {
(void)kind;
- return NULL;
+ return nullptr;
}
/*
@@ -455,11 +455,11 @@ static int stub_iggcsi00(csi_area *a, void *ctx) {
/**
* @brief Open the test catalog.
- * @return The file, or NULL if there is none.
+ * @return The file, or nullptr if there is none.
*/
static FILE *test_catalog(void) {
const char *path = getenv("ZASH_TEST_CATALOG");
- return path ? fopen(path, "r") : NULL;
+ return path ? fopen(path, "r") : nullptr;
}
/**
@@ -467,7 +467,7 @@ static FILE *test_catalog(void) {
* @return true if a test catalog is named.
*/
bool sys_has_catalog(void) {
- return getenv("ZASH_TEST_CATALOG") != NULL;
+ return getenv("ZASH_TEST_CATALOG") != nullptr;
}
/** @brief Work area size for the stand-in: small, to force resumes. */