[PATCH:setxkbmap] Add const attributes to fix gcc -Wwrite-strings warnings

Alan Coopersmith alan.coopersmith at oracle.com
Mon Sep 26 16:09:11 PDT 2011


Fixes many, but not all, of the warnings raised by this option

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 setxkbmap.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/setxkbmap.c b/setxkbmap.c
index 9bfe0df..cde779c 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -81,7 +81,7 @@ static Display *dpy;
  * human-readable versions of FROM_CONFIG, FROM_SERVER, etc. Used for error
  * reporting.
  */
-static char *srcName[NUM_SOURCES] = {
+static const char *srcName[NUM_SOURCES] = {
     "undefined", "X server", "rules file", "config file", "command line"
 };
 
@@ -174,7 +174,7 @@ static int deviceSpec = XkbUseCoreKbd;
 
 /***====================================================================***/
 
-Bool addToList(list_t *list, char *newVal);
+Bool addToList(list_t *list, const char *newVal);
 void usage(int argc, char **argv);
 void dumpNames(Bool wantRules, Bool wantCNames);
 void trySetString(setting_t * setting, char *newVal, enum source src);
@@ -199,7 +199,7 @@ void printKeymap(void);
 */
 
 Bool
-addToList(list_t *list, char *newVal)
+addToList(list_t *list, const char *newVal)
 {
     register int i;
 
@@ -925,7 +925,7 @@ applyRules(void)
 /* Primitive sanity check - filter out 'map names' (inside parenthesis) */
 /* that can confuse xkbcomp parser */
 static Bool
-checkName(char *name, char *string)
+checkName(char *name, const char *string)
 {
     char *i = name, *opar = NULL;
     Bool ret = True;
-- 
1.7.3.2



More information about the xorg-devel mailing list