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

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 31 15:40:32 PDT 2011


On Mon, Oct 31, 2011 at 10:28:11AM +0100, walter harms wrote:
> 
> 
> 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);

possibly, but it's outside of this patch series and I'd rather not work on
the joystick driver more than necessary. feel free to submit a patch though.

Cheers,
  Peter
> 
> 
> 
> > -    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