Re: [patch 10/13] net/socket.c::sys_bind() cleanup.
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2004-11-25 10:19:51
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2004-11-25 10:19:51
David Stevens [off-list ref] wrote:
It's just a style issue, so maybe you'll disagree, but I prefer:
if (!sock)
return err;
to your
if (!sock)
goto out;
...
out:
return err;
I think "return err" is more readable than "goto out/return err"
for
that path and having another "return err" for the out-with-put case isn't
a
terrible thing.When used in isolation you would be right. However when there are multiple exit points then the goto is better because it means that we have only one exit path. When you have multiple exit paths it's very easy to get memory leaks and missing unlock's. -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt