[cairo] [PATCH 10/51] core: fixed code duplication

Chris Wilson chris at chris-wilson.co.uk
Wed Dec 23 02:54:19 PST 2015


On Wed, Dec 23, 2015 at 12:07:55AM +0100, Enrico Weigelt, metux IT consult wrote:
> On 22.12.2015 23:37, Bryce Harrington wrote:
> 
> Hi,
> 
> > I think he's referring to the lack of a space after the if.
> 
> okay, already fixed that. also replaced the whitespaces in comments
> by tabs.
> 
> by the way: should we perhaps let tools like astyle do these checks ?
> 
> >> we could also check for both:
> >>
> >>      ((clip->boxes == NULL) || (clip->num_boxes == 0))
> >>
> >> I'd guess the compiler could generate a vector op for that, if the
> >> fields are direct neighbors and properly aligned.
> > 
> > I suppose.  What you had looked ok to me, but I'll never argue against
> > adding asserts().
> 
> okay, should I add asserts whereever I make any assumptions ?
> (eg. also everywhere I dereference pointers, which arent checked
> explicitly)

No. num_boxes == 0 may mean something very special and is situation
specific, like the code you extracted this function from.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list