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:31:26 -0600 |
| commit | c7f23b8a5fb86f8df51809aca64415bcadcaa9f6 (patch) | |
| tree | ed69eb7c56f705829a2fd5045350a9333e94c401 /src/pattern.c | |
| parent | 7a7320b6a0d7dd6864b708b7e74fb5032a5bdf8e (diff) | |
| download | zash-c7f23b8a5fb86f8df51809aca64415bcadcaa9f6.tar.gz | |
C23: nullptr for null pointers, constexpr for typed constants
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/pattern.c')
| -rw-r--r-- | src/pattern.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pattern.c b/src/pattern.c index b54bf49..a60f643 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -18,7 +18,7 @@ * @return The index, or -1 if `c` is not in it. */ static int index_in(const char *set, unsigned char c) { - const char *p = c ? strchr(set, c) : NULL; + const char *p = c ? strchr(set, c) : nullptr; return p ? (int)(p - set) : -1; } @@ -129,8 +129,8 @@ static int match_bracket(const char *p, const char **endp, unsigned char c) { * @return true if all of [s, send) matches. */ bool pat_match(const char *pat, const char *s, const char *send) { - const char *star_pat = NULL; - const char *star_s = NULL; + const char *star_pat = nullptr; + const char *star_s = nullptr; for (;;) { char c = *pat; if (c == '*') { @@ -244,7 +244,7 @@ static void glob_from(globber *g, const char *pat) { if (dir) { char *comp = arena_strndup(&scratch, pat, clen); const struct dirent *de; - while ((de = readdir(dir)) != NULL) { + while ((de = readdir(dir)) != nullptr) { const char *name = de->d_name; if (name[0] == '.' && comp[0] != '.' && !(comp[0] == '\\' && comp[1] == '.')) |
