[PATCH 2 of 3] inotify: _inotify.c: do not use "goto bail" and XDECREF's when returns can do
Matt Mackall
mpm at selenic.com
Mon Aug 31 17:53:00 CDT 2009
On Mon, 2009-08-31 at 10:31 -0700, Bryan O'Sullivan wrote:
> On Thu, Aug 27, 2009 at 3:01 AM, Nicolas Dumazet <nicdumz at gmail.com>
> wrote:
> inotify: _inotify.c: do not use "goto bail" and XDECREF's when
> returns can do
>
> Using gotos hurt code readability: it's not necessary to put a
> goto to a label
> containing fail-safe instructions (Py_CLEAR, Py_XDECREF do not
> fail if the
> the target is NULL) when a simple "return NULL" can do
> instead.
>
>
> NAK.
For the record, I agree with Bryan. Mercurial's C coding style is more
or less the same as the Linux kernel's. And the kernel has evolved this
particular goto style as a way to robustly deal with unraveling things
on errors. Other ways exist and might even be more obvious to newcomers,
but the kernel style is actually better in practice despite violating
the goto taboo.
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list