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

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 26 17:08:35 PDT 2011


On Mon, Sep 26, 2011 at 04:09:11PM -0700, Alan Coopersmith wrote:
> Fixes many, but not all, of the warnings raised by this option
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter

> ---
>  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
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list