From: "Jörg Sommer" <joerg@jo-so.de>
To: zsh-workers@zsh.org
Cc: "Jörg Sommer" <joerg@jo-so.de>
Subject: [PATCH 2/6] lex: Mark variables with const init as const
Date: Mon, 1 Jan 2024 19:10:17 +0100 [thread overview]
Message-ID: <da1d39281afe608b6567af7e499af74df428c1ed.1704132620.git.joerg@jo-so.de> (raw)
In-Reply-To: <8a1e39c6b8f061ce6d2e37c86e6d889309250f13.1704132620.git.joerg@jo-so.de>
Because these variables are initialized with as constant string, they should
be marked as *const* to make the compiler running with `-Wwrite-strings`
more happy.
---
Src/lex.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Src/lex.c b/Src/lex.c
index 31b130b07..e2aa059cd 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -168,7 +168,7 @@ static struct lexbufstate lexbuf_raw;
/* text of punctuation tokens */
/**/
-mod_export char *tokstrings[WHILE + 1] = {
+mod_export const char *tokstrings[WHILE + 1] = {
NULL, /* NULLTOK 0 */
";", /* SEPER */
"\\n", /* NEWLIN */
@@ -410,8 +410,8 @@ void
initlextabs(void)
{
int t0;
- static char *lx1 = "\\q\n;!&|(){}[]<>";
- static char *lx2 = ";)|$[]~({}><=\\\'\"`,-!";
+ static const char *lx1 = "\\q\n;!&|(){}[]<>";
+ static const char *lx2 = ";)|$[]~({}><=\\\'\"`,-!";
for (t0 = 0; t0 != 256; t0++) {
lexact1[t0] = LX1_OTHER;
--
2.43.0
next prev parent reply other threads:[~2024-01-01 18:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-01 18:10 Extend usage of const char* Jörg Sommer
2024-01-01 18:10 ` [PATCH 1/6] zle.textobjects: Mark variables as const Jörg Sommer
2024-01-01 18:10 ` Jörg Sommer [this message]
2024-01-26 7:39 ` [PATCH 2/6] lex: Mark variables with const init " Oliver Kiddle
2024-01-27 6:41 ` Jörg Sommer
2024-01-28 0:18 ` Oliver Kiddle
2024-01-01 18:10 ` [PATCH 3/6] zle_vi: " Jörg Sommer
2024-01-01 18:10 ` [PATCH 4/6] zle_main: mark statusline " Jörg Sommer
2024-01-01 18:10 ` [PATCH 5/6] module: Mark name argument of some functions const Jörg Sommer
2024-01-01 18:10 ` [PATCH 6/6] zsh: mark hookdef.name as const Jörg Sommer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da1d39281afe608b6567af7e499af74df428c1ed.1704132620.git.joerg@jo-so.de \
--to=joerg@jo-so.de \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).