diff options
author | Erik Skultety <eskultet@redhat.com> | 2016-02-12 10:15:57 +0100 |
---|---|---|
committer | Erik Skultety <eskultet@redhat.com> | 2016-02-17 12:46:34 +0100 |
commit | 353de572a6d5167e337bee4151e250f47bb3ae90 (patch) | |
tree | b4f5f4d0e8301bf47a88748feef20b00d8e8cd7c /tests/virnetdaemondata | |
parent | cc48d3a12244a2bd7fc09512a83afbb57e4cb153 (diff) | |
download | libvirt-353de572a6d5167e337bee4151e250f47bb3ae90.tar.gz |
util: Refactor virHashForEach so it returns as soon as an iterator fails
The method will now return 0 on success and -1 on error, rather than number of
items which it iterated over before it returned back to the caller. Since the
only place where we actually check the number of elements iterated is in
virhashtest, return value of 0 and -1 can be a pretty accurate hint that it
iterated over all the items. However, if we really want to know the number of
items iterated over (like virhashtest does), a counter has to be provided
through opaque data to each iterator call. This patch adjusts return value of
virHashForEach, refactors the body, so it returns as soon as one of the
iterators fail and adjusts virhashtest to reflect these changes.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Diffstat (limited to 'tests/virnetdaemondata')
0 files changed, 0 insertions, 0 deletions