Thread (32 messages) flat view 32 messages, 4 authors, 2016-06-15

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

From: Jeff King <hidden>
Date: 2016-06-15 23:02:39

On Sat, Oct 04, 2014 at 12:55:13AM +0200, René Scharfe wrote:
quoted
-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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help