diff options
author | Eric Blake <eblake@redhat.com> | 2016-01-29 06:48:45 -0700 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-02-08 17:29:55 +0100 |
commit | 9dbb8fa7eff6e5e4cfd83ea26dc67f8404b84aa2 (patch) | |
tree | 976a5d85bfaf10356088e37110b19d44f48b9401 | |
parent | 014791b0df927226b794d14696724b9c9c0583d0 (diff) |
balloon: Improve use of qapi visitor
Rework the control flow of balloon_stats_get_all() to make it
easier for a later patch to split visit_end_struct(). Also
switch to the uint64 visitor to match the data type.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1454075341-13658-10-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | hw/virtio/virtio-balloon.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 5c3020331c..06912bbe6d 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -133,9 +133,11 @@ static void balloon_stats_get_all(Object *obj, struct Visitor *v, if (err) { goto out_end; } - for (i = 0; !err && i < VIRTIO_BALLOON_S_NR; i++) { - visit_type_int64(v, (int64_t *) &s->stats[i], balloon_stat_names[i], - &err); + for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) { + visit_type_uint64(v, &s->stats[i], balloon_stat_names[i], &err); + if (err) { + break; + } } error_propagate(errp, err); err = NULL; |