Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 2/6] lex: Mark variables with const init as const



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





Messages sorted by: Reverse Date, Date, Thread, Author