[PATCH] Make RegionInit() and RegionCreate() take just a box and no size

Daniel Stone daniel at fooishbar.org
Mon May 9 08:22:34 PDT 2011

On Mon, May 09, 2011 at 05:18:29PM +0200, Soeren Sandmann wrote:
> Daniel Stone <daniel at fooishbar.org> writes:
> > On Mon, May 02, 2011 at 07:44:15AM -0400, Søren Sandmann wrote:
> >> The interface to these function was was very confusing since it gave
> >> the impression that they initialized the region from a list of boxes,
> >> which they didn't.
> >> 
> >> This patch changes the interface to take just one box and fixes all
> >> the callers accordingly.
> >
> > Why not just change all RegionInit(region, box, 1) calls to use
> > RegionInitBoxes(region, box, 1), and add a RegionCreateBoxes() or
> > similar?
> Advantage of adding a new function are that that it will automatically
> catch cases where "0" is currently being passed for the number of boxes,
> and people who haven't paid attention won't be tempted to create new
> bugs.

Sure -- so if you change everyone to use RegionInitBoxes, then happy
days, right? Surely that's the API we want, noting that the extent-only
case you've implemented with RegionInit(rgn, extents) is possible with
RegionInitBoxes(rgn, extents, 1).  Seems like it'd be best to just
remove the arguments completely rather than making them extent-only,
such that they created/initialised to an empty region.  That way there's
no lingering confusion at all.


More information about the xorg-devel mailing list