From 87281920e1d15d4dc5c50f79750ab9ff173c0e8d Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 16 Jul 2019 04:40:55 -0400 Subject: fix const-warnings in grammar using a non-const initializer Signed-off-by: Thomas E. Dickey --- src/gram.y | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gram.y b/src/gram.y index d9fe680..d55ae91 100644 --- a/src/gram.y +++ b/src/gram.y @@ -78,8 +78,9 @@ in this Software without prior written authorization from The Open Group. #include #include -static char *Action = ""; -static char *Name = ""; +static char empty[1]; +static char *Action = empty; +static char *Name = empty; static MenuRoot *root, *pull = NULL; static MenuRoot *GetRoot ( const char *name, const char *fore, const char *back ); @@ -193,7 +194,7 @@ stmt : error AddToMenu(root,"x",Action, NULL,$2,NULLSTR,NULLSTR); } - Action = ""; + Action = empty; pull = NULL; } | string fullkey { GotKey($1, $2); } @@ -259,7 +260,7 @@ stmt : error AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); } - Action = ""; + Action = empty; pull = NULL; } | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; @@ -267,7 +268,7 @@ stmt : error Scr->WindowFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); - Action = ""; + Action = empty; pull = NULL; } | WARP_CURSOR { list = &Scr->WarpCursorL; } @@ -567,9 +568,9 @@ function_entries: /* Empty */ | function_entries function_entry ; -function_entry : action { AddToMenu(root, "", Action, NULL, $1, +function_entry : action { AddToMenu(root, empty, Action, NULL, $1, NULLSTR, NULLSTR); - Action = ""; + Action = empty; } ; @@ -582,13 +583,13 @@ menu_entries : /* Empty */ menu_entry : string action { AddToMenu(root, $1, Action, pull, $2, NULLSTR, NULLSTR); - Action = ""; + Action = empty; pull = NULL; } | string LP string COLON string RP action { AddToMenu(root, $1, Action, pull, $7, $3, $5); - Action = ""; + Action = empty; pull = NULL; } ; @@ -797,7 +798,7 @@ static void GotButton(int butt, int func) NULL, func, NULLSTR, NULLSTR); } } - Action = ""; + Action = empty; pull = NULL; cont = 0; mods_used |= (unsigned)mods; @@ -816,7 +817,7 @@ static void GotKey(char *key, int func) break; } - Action = ""; + Action = empty; pull = NULL; cont = 0; mods_used |= (unsigned)mods; @@ -832,7 +833,7 @@ static void GotTitleButton (char *bitmapname, int func, Bool rightside) "unable to create %s titlebutton \"%s\"\n", rightside ? "right" : "left", bitmapname); } - Action = ""; + Action = empty; pull = NULL; } -- cgit v1.2.3