From: Junio C Hamano Date: Mon, 02 May 2016 18:06:56 GMT Subject: Re: [PATCH 25/29] refs: resolve symbolic refs first Message-ID: In-Reply-To: <1461886803.4123.14.camel@twopensource.com> David Turner writes: > 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).