[cairo] [cairo-commit] 2 commits - src/cairo-surface.c

Andrea Canciani ranma42 at gmail.com
Thu Dec 30 01:58:31 PST 2010


On Thu, Dec 30, 2010 at 10:18 AM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Minor comment on another wise good patch.
>
> On Wed, 29 Dec 2010 10:07:30 -0800 (PST), ranma42 at kemper.freedesktop.org (Andrea Canciani) wrote:
>> commit 59ac884c607c024d0608cf7dec52509d9e9e328e
>> Author: Uli Schlachter <psychon at znc.in>
>> Date:   Sat Dec 25 23:39:21 2010 +0100
>>
>>     Verify that surfaces leak no snapshots
>>
>>     Finished surfaces should own no snapshots, because finished surfaces
>>     can't be used as sources, thus their snapshots would never be used.
>>
>>     When free'ing the surface in cairo_surface_destroy(), it should have
>>     no snapshots, or they will be leaked.
>>
>>     Signed-off-by: Uli Schlachter <psychon at znc.in>
>>
>> diff --git a/src/cairo-surface.c b/src/cairo-surface.c
>> index 01ea27a..bc80d08 100644
>> --- a/src/cairo-surface.c
>> +++ b/src/cairo-surface.c
>> @@ -654,6 +654,9 @@ cairo_surface_destroy (cairo_surface_t *surface)
>>      if (surface->owns_device)
>>          cairo_device_destroy (surface->device);
>>
>> +    assert (surface->snapshot_of == NULL);
>> +    assert (!_cairo_surface_has_snapshots (surface));
>
> We like a space between the logical negation and its object:
>
>  assert (! _cairo_surface_has_snapshots (surface));
>
> It just helps to make that operator more clear in dense code.

Oops, I didn't know about it.
Should we add this to CODING_STYLE?
It would be a good idea to point out if "!" should always be followed
by a space or which exceptions we want (like "!!").
Some "missing" whitespaces are pointed out by:
  git grep '![^ =]' src/

Andrea

PS: I'd love an automated way to point out where we're not respecting
CODING_STYLE. I know that there are sometimes legitimate reasons
to ignore it, but it would be nice to be notified about it, so that we only
do it intentionally.


More information about the cairo mailing list