]> git.ozlabs.org Git - ccan/commit - ccan/aga/aga.h
aga: Fix initialization bug in aga_for_each_edge_info
authorDavid Gibson <david@gibson.dropbear.id.au>
Tue, 3 Nov 2015 02:01:07 +0000 (13:01 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 3 Nov 2015 02:01:07 +0000 (13:01 +1100)
commit2ab26c629fcad393fd3da70e1bd26ed29048c950
tree9369eb947757a95440d1feb3b04b8b267dc3c54f
parentbd0400d609e4c1b7fda6b6fa11ca358cd72f4673
aga: Fix initialization bug in aga_for_each_edge_info

The aga_for_each_edge_info macro is constructed so that if the edge_info
callback returns an error, the for loop terminates early and leaves the
_err parameter set to the error.  On successful completion of the loop,
_err should be zero.

However, on a node with no edges, _err will not be initialized, meaning
that it could be non-zero even on successful (trivial) completion of the
loop.  This fixes the bug.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/aga/aga.h
ccan/aga/test/api-adjacency.c