summaryrefslogtreecommitdiffhomepage
path: root/src/mvsfmt.h
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/mvsfmt.h
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/mvsfmt.h')
-rw-r--r--src/mvsfmt.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mvsfmt.h b/src/mvsfmt.h
index 9a6e845..4cb3201 100644
--- a/src/mvsfmt.h
+++ b/src/mvsfmt.h
@@ -20,7 +20,7 @@
#include <stdint.h>
/** @brief Longest data set name. */
-#define MVS_DSN_MAX 44
+constexpr unsigned MVS_DSN_MAX = 44;
/** @brief IBM-1047 to ISO8859-1, with z/OS's NL/LF assignment. */
extern const unsigned char mvs_e2a[256];
@@ -43,9 +43,9 @@ typedef void mvs_name_fn(const char *name, char type, void *arg);
/* ---- Catalog Search Interface ----------------------------------------- */
/** @brief Selection criteria with one field name (CSIFIELD). */
-#define CSI_FIELD_LEN 162
+constexpr unsigned CSI_FIELD_LEN = 162;
/** @brief Smallest work area worth passing. */
-#define CSI_WORK_MIN 1024
+constexpr unsigned CSI_WORK_MIN = 1024;
/**
* @brief The three areas of a CSI call, as IGGCSI00 sees them.
@@ -78,7 +78,7 @@ bool csi_search(const char *filter, csi_area *a, csi_call_fn *call, void *ctx,
/* ---- PDS directories and the TIOT -------------------------------------- */
/** @brief Size of a PDS directory block. */
-#define PDS_DIRBLK 256
+constexpr unsigned PDS_DIRBLK = 256;
bool pds_parse_block(const unsigned char *blk, mvs_name_fn *fn, void *arg,
bool *end);