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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]