[PATCH] xf86/modes: Defang stale pointers when copying modes
Chris Wilson
chris at chris-wilson.co.uk
Thu May 31 02:06:58 PDT 2012
On Wed, 30 May 2012 14:25:40 -0700, Keith Packard <keithp at keithp.com> wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
>
> > +extern _X_EXPORT void
> > +xf86InternMode(DisplayModePtr intern, const DisplayModeRec * pMode);
>
> The name doesn't seem very descriptive to me -- what is 'Intern'
> supposed to mean?
xf86InternalizeMode? xf86InitModeFromCopy? xf86CopyModeToStatic?
> > /**
> > + * Fills in a copy of mode, removing all stale pointer references.
Fills in an embedded copy of mode, removing all stale pointer
references and copying only the modeline configuration. Subsequently
comparing the copy with the original with xf86ModesEqual() will
return TRUE.
> > + */
> > +void
> > +xf86InternMode(DisplayModePtr intern, const DisplayModeRec *mode)
> > +{
> > + *intern = *mode;
> > + intern->prev = intern->next = NULL;
> > + intern->name = NULL;
> > +}
> What should be done with ->Private? If this mode was ever actually handed
> to a driver, it might not be NULL...
/* And drop the backend's privates. */
intern->PrivSize = 0;
intern->PrivFlags = 0;
intern->Private = 0;
--
Chris Wilson, Intel Open Source Technology Centre
More information about the xorg-devel
mailing list