diff options
author | Eric Blake <eblake@redhat.com> | 2021-01-13 16:10:13 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-01-28 08:08:45 +0100 |
commit | 95b3a8c8a82a34ca874ac0d4a9bbbdb38034acf3 (patch) | |
tree | 76d842228434aa8ac1dc10f8fcc4bfc5cce422d5 /block/qapi.c | |
parent | c3033fd372fdaf5b89190136a74b3d78880b85d6 (diff) |
qapi: More complex uses of QAPI_LIST_APPEND
These cases require a bit more thought to review; in each case, the
code was appending to a list, but not with a FOOList **tail variable.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210113221013.390592-6-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Flawed change to qmp_guest_network_get_interfaces() dropped]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r-- | block/qapi.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/block/qapi.c b/block/qapi.c index 3a1186fdcc..0a96099e36 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -198,7 +198,7 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs, { int i, sn_count; QEMUSnapshotInfo *sn_tab = NULL; - SnapshotInfoList *info_list, *cur_item = NULL, *head = NULL; + SnapshotInfoList *head = NULL, **tail = &head; SnapshotInfo *info; sn_count = bdrv_snapshot_list(bs, &sn_tab); @@ -233,17 +233,7 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs, info->icount = sn_tab[i].icount; info->has_icount = sn_tab[i].icount != -1ULL; - info_list = g_new0(SnapshotInfoList, 1); - info_list->value = info; - - /* XXX: waiting for the qapi to support qemu-queue.h types */ - if (!cur_item) { - head = cur_item = info_list; - } else { - cur_item->next = info_list; - cur_item = info_list; - } - + QAPI_LIST_APPEND(tail, info); } g_free(sn_tab); |