From fb8f7b94aa2f422a3981e05b71a7e7a2eb43bf05 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Thu, 10 Oct 2024 20:11:37 +0100 Subject: [PATCH] LookupStructFull() constify call-site txInput.c: LookupStructFull() constify call-site DBlabel.c: LookupStructFull() constify call-site --- database/DBlabel.c | 4 ++-- textio/txInput.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/database/DBlabel.c b/database/DBlabel.c index 388c9da6..1766496d 100644 --- a/database/DBlabel.c +++ b/database/DBlabel.c @@ -1549,7 +1549,7 @@ DBLoadFont(fontfile, scale) float scale; { FILE *ff; - char *ascii_names[] = { + const char * const ascii_names[] = { "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", @@ -1654,7 +1654,7 @@ DBLoadFont(fontfile, scale) { if (psname != NULL) { - asciiidx = LookupStructFull(psname, ascii_names, sizeof(char *)); + asciiidx = LookupStructFull(psname, ascii_names, sizeof(const char *)); if (asciiidx >= 0) chardef = 2; } diff --git a/textio/txInput.c b/textio/txInput.c index 7a22eafb..3a6ef16d 100644 --- a/textio/txInput.c +++ b/textio/txInput.c @@ -105,11 +105,11 @@ char *magic_direction_list[] = { #define DIRECT_COMPL 10 /* Can only accommodate 32 arg options, increase as necessary */ -static struct cmd_spec { - char *cmd; +static const struct cmd_spec { + const char *cmd; int type; char *args[32]; -} magic_cmd_spec[] = { +} const magic_cmd_spec[] = { { "", COMMAND_COMPL, {(char *)NULL} }, { "help", COMMAND_COMPL, {(char *)NULL} }, @@ -595,13 +595,13 @@ magic_completion_function(char *text, int start, int end) strcat(line, " "); } - entry = LookupStructFull(line, (char **)&magic_cmd_spec, + entry = LookupStructFull(line, (const char * const *)&magic_cmd_spec, sizeof(struct cmd_spec)); if (entry == -1 && num_tokens >= 1) { sprintf(line, "%s*", tokens[0]); - entry = LookupStructFull(line, (char **)&magic_cmd_spec, + entry = LookupStructFull(line, (const char * const *)&magic_cmd_spec, sizeof(struct cmd_spec)); }