summaryrefslogtreecommitdiffhomepage
path: root/src/sys_zos.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_zos.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_zos.c')
-rw-r--r--src/sys_zos.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sys_zos.c b/src/sys_zos.c
index f6fc862..38908ce 100644
--- a/src/sys_zos.c
+++ b/src/sys_zos.c
@@ -473,7 +473,7 @@ int sys_tag_get(const char *path, sys_tag *tag) {
/**
* @brief Change a file's tag.
* @param path The file.
- * @param codeset A code set name or CCSID number. NULL removes the tag;
+ * @param codeset A code set name or CCSID number. nullptr removes the tag;
* "BINARY" tags the file as binary.
* @param text 1 text, 0 not text, -1 keep the current flag.
* @return 0, or -1 with errno set (EINVAL for an unknown code set).
@@ -597,7 +597,7 @@ const char *sys_info(sys_info_kind kind) {
* IBM recommends 64000; 32K already holds more names than a completion
* screen shows, and it is taken per search rather than held.
*/
-#define CSI_WORK 32768
+constexpr unsigned CSI_WORK = 32768; /**< work area for one IGGCSI00 search */
/** @brief One search's storage: taken per search, freed before return. */
typedef struct csi_req {
@@ -609,7 +609,7 @@ typedef struct csi_req {
typedef int iggcsi_fn(void *reason, void *field, void *work);
#pragma linkage(iggcsi_fn, OS)
-static iggcsi_fn *csi_ep; /**< from fetch(), NULL until loaded */
+static iggcsi_fn *csi_ep; /**< from fetch(), nullptr until loaded */
static bool csi_dead; /**< fetch failed or a call abended */
static bool csi_in_flight; /**< one search at a time */
@@ -649,7 +649,7 @@ static int csi_call(csi_area *a, void *ctx) {
rc = CSI_ABENDED;
}
for (int i = 0; i < NSIG_CSI; i++)
- sigaction(sigs[i], &old[i], NULL);
+ sigaction(sigs[i], &old[i], nullptr);
return rc;
}
@@ -691,7 +691,7 @@ bool sys_catalog_list(const char *filter, mvs_name_fn *fn, void *arg) {
free(r);
if (abended) {
(void)release((void (*)(void))csi_ep);
- csi_ep = NULL;
+ csi_ep = nullptr;
csi_dead = true;
ok = false;
}
@@ -743,7 +743,7 @@ bool sys_pds_members(const char *dsn, mvs_name_fn *fn, void *arg) {
*/
bool sys_dd_names(mvs_name_fn *fn, void *arg) {
const unsigned char *tcb = ptr31(0x21c);
- const unsigned char *tiot = tcb ? ptr31((uintptr_t)(tcb + 0xc)) : NULL;
+ const unsigned char *tiot = tcb ? ptr31((uintptr_t)(tcb + 0xc)) : nullptr;
if (!tiot)
return false;
return tiot_parse(tiot + 24, TIOT_MAX, fn, arg);