[PATCH] xfree86: add xf86OptionListDuplicate()
Peter Hutterer
peter.hutterer at who-t.net
Fri Sep 17 06:40:25 PDT 2010
On Mon, Sep 13, 2010 at 09:44:29PM +0300, Tiago Vignatti wrote:
> On Mon, Sep 13, 2010 at 09:32:22AM +0200, ext Peter Hutterer wrote:
> > On Fri, Sep 10, 2010 at 09:56:44AM +1000, Peter Hutterer wrote:
> > > Does what it says on the box.
> > >
> > > Some drivers need to duplicate option lists from the original device to
> > > ensure that devices created by the driver (driver-internal hotplugging) have
> > > the same list of options as the original device.
> > >
> > > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > > ---
> >
> > Can I get a review for this please? It's one of the hooks I need to switch
> > the input drivers over to the new API.
> >
> > Cheers,
> > Peter
> >
> > > hw/xfree86/common/xf86Opt.h | 1 +
> > > hw/xfree86/common/xf86Option.c | 19 +++++++++++++++++++
> > > 2 files changed, 20 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
> > > index d75d3bf..9453f2a 100644
> > > --- a/hw/xfree86/common/xf86Opt.h
> > > +++ b/hw/xfree86/common/xf86Opt.h
> > > @@ -84,6 +84,7 @@ extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
> > > extern _X_EXPORT pointer xf86NextOption(pointer list );
> > > extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
> > > extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
> > > +extern _X_EXPORT pointer xf86OptionListDuplicate(pointer list);
> > > extern _X_EXPORT void xf86OptionListFree(pointer opt);
> > > extern _X_EXPORT char *xf86OptionName(pointer opt);
> > > extern _X_EXPORT char *xf86OptionValue(pointer opt);
> > > diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
> > > index 7ca2fdd..2ed6d6f 100644
> > > --- a/hw/xfree86/common/xf86Option.c
> > > +++ b/hw/xfree86/common/xf86Option.c
> > > @@ -136,6 +136,25 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
> > > }
> > > }
> > >
> > > +/**
> > > + * Duplicate the option list passed in. The returned pointer will be a newly
> > > + * allocated option list and must be freed by the caller.
> > > + */
> > > +pointer
> > > +xf86OptionListDuplicate(pointer options)
> > > +{
> > > + pointer o = NULL;
> > > +
> > > + while (options)
> > > + {
> > > + o = xf86AddNewOption(o, xf86OptionName(options), xf86OptionValue(options));
> > > + options = xf86NextOption(options);
>
> xf86nextOption seems more appropriated to be used inside the server only.
amended, thanks. don't think it matters much and all the upper/lowercase
calls for options seems to be in use in nondeterministic patterns. a
possible cleanup follow-up patch.
Cheers,
Peter
> > > + }
> > > +
> > > + return o;
> > > +}
> > > +
> > > +
> > > /* Created for new XInput stuff -- essentially extensions to the parser */
> > >
> > > static int
>
> Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>
>
> Tiago
More information about the xorg-devel
mailing list