[PATCH 01/11] dix: split out window owner event delivery from DeliverEventsToWindow

Peter Hutterer peter.hutterer at who-t.net
Wed May 11 18:14:07 PDT 2011


On Wed, May 11, 2011 at 05:51:50PM -0700, Jamey Sharp wrote:
> On Thu, May 12, 2011 at 10:33:43AM +1000, Peter Hutterer wrote:
> > I'm a big fan of the goto out because it makes debugging so much easier.
> > setting a breakpoint or adding a printf at a single point is faster than
> > remembering to set 5 points. That's pretty much the only reason for me.
> 
> I see your point, and raise you two counter-points:

doh. Now I need to come up with more counter points to match your offer and
raise the stakes :)

> This function is only called in one place. You can set a breakpoint or
> add a printf there and catch all return paths in either style. (For that
> matter, gdb's "finish" command will tell you what the return value was
> no matter which path the function exited through, so you only need a
> breakpoint on function entry...)

finish is great for rarely called functions, bad for anything in the event
path that gets hammered whenever you do so much as think of the mouse.

> In my opinion, the control flow in this function is so much easier to
> read and reason about with early-return that any convenience in the
> (hopefully rare!) case of needing to debug it is outweighed anyway.
> 
> I believe you that there are times when early return is the wrong
> choice, but I don't think this is one of them.

damn. couldn't come up with another point. ok, you win.

Cheers,
  Peter


More information about the xorg-devel mailing list