Subject: Re: [PATCH 01/16] foreach_alt_odb: propagate return value from callback

From: Jeff King <[email-masked]>
Date: Fri, 3 Oct 2014 20:31:48 -0400

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