From: Jeff King Date: Sat, 04 Oct 2014 00:31:48 GMT Subject: Re: [PATCH 01/16] foreach_alt_odb: propagate return value from callback Message-ID: <20141004003148.GF17063@peff.net> In-Reply-To: <542F2951.5050203@web.de> On Sat, Oct 04, 2014 at 12:55:13AM +0200, René Scharfe wrote: > >-void foreach_alt_odb(alt_odb_fn fn, void *cb) > >+int foreach_alt_odb(alt_odb_fn fn, void *cb) > > { > > struct alternate_object_database *ent; > >+ int r = 0; > > > > prepare_alt_odb(); > >- for (ent = alt_odb_list; ent; ent = ent->next) > >- if (fn(ent, cb)) > >- return; > >+ for (ent = alt_odb_list; ent; ent = ent->next) { > >+ int r = fn(ent, cb); > >+ if (r) > >+ break; > >+ } > >+ return r; > > This will always return zero. You probably shadowed r unintentionally > inside the loop, right? Eek, yes. Thanks for catching. I'll fix it in the re-roll. -Peff