[PATCH setxkbmap 2/2] Removed unneeded arg name in applyConfig()

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 24 20:16:45 PST 2011


On Tue, Feb 22, 2011 at 10:18:57AM +0500, Alexandr Shadchin wrote:
> Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>
> ---
>  setxkbmap.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/setxkbmap.c b/setxkbmap.c
> index 1c9c89e..6c678ff 100644
> --- a/setxkbmap.c
> +++ b/setxkbmap.c
> @@ -181,7 +181,7 @@ Bool getServerValues(void);
>  FILE *findFileInPath(char *name);
>  Bool addStringToOptions(char *opt_str, list_t * opts);
>  char *stringFromOptions(char *orig, list_t * newOpts);
> -Bool applyConfig(char *name);
> +Bool applyConfig(void);
>  Bool applyRules(void);
>  Bool applyComponentNames(void);
>  void printKeymap(void);
> @@ -734,18 +734,19 @@ stringFromOptions(char *orig, list_t * newOpts)
>  /***====================================================================***/
>  
>  Bool
> -applyConfig(char *name)
> +applyConfig(void)
>  {
>      FILE *fp;
>      Bool ok;
>  
> -    if ((fp = findFileInPath(name)) == NULL)
> +    if ((fp = findFileInPath(settings.config.value)) == NULL)
>          return False;
>      ok = XkbCFParse(fp, XkbCFDflts, NULL, &cfgResult);
>      fclose(fp);
>      if (!ok)
>      {
> -        ERR1("Couldn't find configuration file \"%s\"\n", name);
> +        ERR1("Couldn't find configuration file \"%s\"\n",
> +             settings.config.value);
>          return False;
>      }
>      if (cfgResult.rules_file)
> @@ -1057,7 +1058,7 @@ main(int argc, char **argv)
>      VMSG1(7, "locale is %s\n", settings.locale.value);
>      if (dpy)
>          getServerValues();
> -    if (settings.config.value && (!applyConfig(settings.config.value)))
> +    if (settings.config.value && (!applyConfig()))
>          exit(-3);
>      if (!applyRules())
>          exit(-4);
> -- 
> 1.7.3.5

NAK, I don't think this is the right fix. instead of relying on magic global
variables we should take parameters.
I just noticed that the global "settings" variable is used anyway, so a
better fix here would be to pass settings in as well.
 
Cheers,
  Peter


More information about the xorg-devel mailing list