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 /net/net.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 'net/net.c')
-rw-r--r-- | net/net.c | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -1213,10 +1213,9 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, Error **errp) { NetClientState *nc; - RxFilterInfoList *filter_list = NULL, *last_entry = NULL; + RxFilterInfoList *filter_list = NULL, **tail = &filter_list; QTAILQ_FOREACH(nc, &net_clients, next) { - RxFilterInfoList *entry; RxFilterInfo *info; if (has_name && strcmp(nc->name, name) != 0) { @@ -1241,15 +1240,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, if (nc->info->query_rx_filter) { info = nc->info->query_rx_filter(nc); - entry = g_malloc0(sizeof(*entry)); - entry->value = info; - - if (!filter_list) { - filter_list = entry; - } else { - last_entry->next = entry; - } - last_entry = entry; + QAPI_LIST_APPEND(tail, info); } else if (has_name) { error_setg(errp, "net client(%s) doesn't support" " rx-filter querying", name); |