[PATCH 2 of 5] lazymanifest: simplify cleanup at end of iteration

Martin von Zweigbergk martinvonz at google.com
Thu Mar 12 18:00:06 CDT 2015


Fair enough. I'll drop the patch and send a V2 of the remaining 3. Thanks.

On Thu, Mar 12, 2015 at 3:49 PM Matt Mackall <mpm at selenic.com> wrote:

> On Wed, 2015-03-11 at 16:14 -0700, Martin von Zweigbergk wrote:
> > # HG changeset patch
> > # User Martin von Zweigbergk <martinvonz at google.com>
> > # Date 1426105596 25200
> > #      Wed Mar 11 13:26:36 2015 -0700
> > # Node ID 7daaf234ddc08ee8dd171a6c2d3347e0caf1632e
> > # Parent  0709db5b7ee275833b41b89feab59625dca28c7a
> > lazymanifest: simplify cleanup at end of iteration
> >
> > When the iterator has been exhausted, there is nothing to clean up, so
> > return early and simplify the remaining code.
>
> I actually prefer the goto pattern. It makes maintaining code with
> multiple exit points and (especially nested) resource unrolling much
> more manageable. And since there's always a risk we'll add new exit
> points here, I'd rather not take a step back here.
>
> See here for a better example of the pattern:
>
> http://www.selenic.com/hg/file/7cf9a9e0cf89/mercurial/osutil.c#l185
>
> And see here for a discussion (chapter 7):
>
> https://www.kernel.org/doc/Documentation/CodingStyle
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150312/522c8008/attachment.html>


More information about the Mercurial-devel mailing list