[PATCH joystick 1/2] Fix option type for option duplication

walter harms wharms at bfs.de
Mon Oct 31 02:28:11 PDT 2011



Am 31.10.2011 05:41, schrieb Peter Hutterer:
> xf86OptionListDuplicate() duplicates an XF86Option list, not an InputOption
> list.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/jstk_key.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/jstk_key.c b/src/jstk_key.c
> index d699dcd..e842941 100644
> --- a/src/jstk_key.c
> +++ b/src/jstk_key.c
> @@ -253,26 +253,26 @@ jstkKeyboardHotplug(InputInfoPtr pInfo, int flags)
>      int rc;
>      char name[512] = {0};
>      InputAttributes *attrs = NULL;
> -    InputOption *options;
>      InputOption *iopts = NULL, *tmp;
>      DeviceIntPtr dev;
> +    XF86OptionPtr opts;
>  
>      /* duplicate option list, append to name */
> -    options = xf86OptionListDuplicate(pInfo->options);
> +    opts = xf86OptionListDuplicate(pInfo->options);

>      strcpy(name, pInfo->name);
>      strcat(name, " (keys)");

perhaps more readable:
	snprintf(name,sizeof(name);"%s (keys)",pInfo->name);



> -    options = xf86ReplaceStrOption(options, "Name", name);
> -    options = xf86ReplaceStrOption(options, "_source", "_driver/joystick");
> +    opts = xf86ReplaceStrOption(opts, "Name", name);
> +    opts = xf86ReplaceStrOption(opts, "_source", "_driver/joystick");
>  
> -    while(options)
> +    while(opts)
>      {
>          tmp = calloc(1, sizeof(InputOption));
>  
> -        tmp->key = xf86OptionName(options);
> -        tmp->value = xf86OptionValue(options);
> +        tmp->key = xf86OptionName(opts);
> +        tmp->value = xf86OptionValue(opts);
>          tmp->next = iopts;
>          iopts = tmp;
> -        options = xf86NextOption(options);
> +        opts = xf86NextOption(opts);
>      }
>  
>      /* duplicate attribute list */


More information about the xorg-devel mailing list