Re: [PATCH 25/29] refs: resolve symbolic refs first
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 2, 2016, 18:06 UTC
- Message-ID
- <xmqq37q0uyf3.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1461886803.4123.14.camel@twopensource.com>
David Turner <dturner@twopensource.com> writes:
Show 7 quoted lines
> On Wed, 2016-04-27 at 18:57 +0200, Michael Haggerty wrote: > +retry: > ... >> + if (--attempts_remaining > 0) >> + goto retry; > > could this be a loop instead of using gotos?
It could be, but given that there are many such exit points, I do not think an added level of indentation with while() loop is particularly a good way to go.
Unless that big body of code that is looped around by implicit "goto retry" is made into a helper function to perform one round of attempt, which may result in one of success, temporary failure, final failure. Then we could do:
int attempts_remaining = N;
int failed_hard = 0;
while (!failed_hard && attempts_remaining--)
failed_hard = attempt();
and the end result _may_ become easier to read (even though I have
to think for a second what the correct code should look like that
comes after the loop).