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/edit_libedit.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/edit_libedit.c')
| -rw-r--r-- | src/edit_libedit.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/edit_libedit.c b/src/edit_libedit.c index 6a32db7..d9282fc 100644 --- a/src/edit_libedit.c +++ b/src/edit_libedit.c @@ -68,7 +68,7 @@ bool edit_usable(void) { * @param prompt Text to show before the line. * @param len Receives the length of the line. * @return The line without its newline, valid until the next call; - * NULL at end of input. + * nullptr at end of input. */ char *edit_readline(const char *prompt, size_t *len) { static char *line; @@ -77,12 +77,12 @@ char *edit_readline(const char *prompt, size_t *len) { el = el_init("zash", stdin, stderr, stderr); el_hist = history_init(); if (!el || !el_hist) - return NULL; + return nullptr; history(el_hist, &ev, H_SETSIZE, 100000); el_set(el, EL_HIST, history, el_hist); el_set(el, EL_PROMPT, prompt_cb); el_set(el, EL_SIGNAL, 0); - el_source(el, NULL); + el_source(el, nullptr); } el_set(el, EL_EDITOR, opt.vi ? "vi" : "emacs"); history(el_hist, &ev, H_CLEAR); @@ -108,7 +108,7 @@ char *edit_readline(const char *prompt, size_t *len) { trap_poll(); /* ^C abandons the line and does not return */ continue; } - return NULL; + return nullptr; } } |
