From 5b6ed5481751f7cd12e92abc2825e0d0e74a2188 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 13 Jun 2026 20:07:30 +0000 Subject: [PATCH] Add some missing const, from Jere Viikari. --- environ.c | 3 ++- format.c | 4 ++-- input-keys.c | 2 +- input.c | 16 ++++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/environ.c b/environ.c index 1e167b8a..f9bc8cab 100644 --- a/environ.c +++ b/environ.c @@ -152,7 +152,8 @@ environ_clear(struct environ *env, const char *name) void environ_put(struct environ *env, const char *var, int flags) { - char *name, *value; + char *name; + const char *value; value = strchr(var, '='); if (value == NULL) diff --git a/format.c b/format.c index 5a0a638e..cb309e08 100644 --- a/format.c +++ b/format.c @@ -3760,7 +3760,7 @@ format_table_compare(const void *key0, const void *entry0) } /* Get a format callback. */ -static struct format_table_entry * +static const struct format_table_entry * format_table_get(const char *key) { return (bsearch(key, format_table, nitems(format_table), @@ -4094,7 +4094,7 @@ static char * format_find(struct format_tree *ft, const char *key, int modifiers, const char *time_format) { - struct format_table_entry *fte; + const struct format_table_entry *fte; void *value; struct format_entry *fe, fe_find; struct environ_entry *envent; diff --git a/input-keys.c b/input-keys.c index 963824c7..7d52106e 100644 --- a/input-keys.c +++ b/input-keys.c @@ -484,7 +484,7 @@ input_key_vt10x(struct bufferevent *bev, key_code key) { struct utf8_data ud; key_code onlykey; - char *p; + const char *p; static const char *standard_map[2] = { "1!9(0)=+;:'\",<.>/-8? 2", "119900=+;;'',,..\x1f\x1f\x7f\x7f\0\0", diff --git a/input.c b/input.c index 0681b88e..22440e81 100644 --- a/input.c +++ b/input.c @@ -1365,7 +1365,7 @@ input_esc_dispatch(struct input_ctx *ictx) { struct screen_write_ctx *sctx = &ictx->ctx; struct screen *s = sctx->s; - struct input_table_entry *entry; + const struct input_table_entry *entry; if (ictx->flags & INPUT_DISCARD) return (0); @@ -1439,12 +1439,12 @@ input_esc_dispatch(struct input_ctx *ictx) static int input_csi_dispatch(struct input_ctx *ictx) { - struct screen_write_ctx *sctx = &ictx->ctx; - struct screen *s = sctx->s; - struct input_table_entry *entry; - struct options *oo; - int i, n, m, ek, set, p; - u_int cx, bg = ictx->cell.cell.bg; + struct screen_write_ctx *sctx = &ictx->ctx; + struct screen *s = sctx->s; + const struct input_table_entry *entry; + struct options *oo; + int i, n, m, ek, set, p; + u_int cx, bg = ictx->cell.cell.bg; if (ictx->flags & INPUT_DISCARD) return (0); @@ -3188,7 +3188,7 @@ static int input_osc_52_parse(struct input_ctx *ictx, const char *p, u_char **out, int *outlen, char *clip) { - char *end; + const char *end; size_t len; const char *allow = "cpqs01234567"; u_int i, j = 0;