[Pixman] [PATCH 3/3] The code in 'bitmap_addrect' already assumes non-nortly reversed:ull 'reg->data'

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Jan 14 03:59:22 PST 2011


On Wednesday 12 January 2011 11:34:03 Soeren Sandmann wrote:
> Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:
> > @@ -2590,6 +2589,8 @@ PREFIX (_init_from_image) (region_type_t *region,
> > 
> >      PREFIX(_init) (region);
> > 
> > +    assert (region->data);
> > +
> > 
> >      return_if_fail (image->type == BITS);
> >      return_if_fail (image->bits.format == PIXMAN_a1);
> 
> I'm a little uncomfortable with adding asserts because if they
> trigger, they will take down the X server. (Even though this one can't
> possibly trigger).
> 
> Instead, I'd rather use the critical_if_fail() macro. If pixman is
> compiled with DEBUG defined, it will print stuff to stderr if the
> given expression fails.

Fair enough. An updated patch is attached.

Does the patch itself look OK? Based on the logic of this code, my 
understanding is that the 'region->data' has non NULL value all the time,
until the very end of 'region_init_from_image' function, where it may be
freed as part of an extra optimization if it happens to be redundant.
I want to be sure that I'm not missing anything while trying to make
static analyzers happy.

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-The-code-in-bitmap_addrect-already-assumes-non-null-.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20110114/5f7cf523/attachment.bin>


More information about the Pixman mailing list