mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
c3033fd372
commit
95b3a8c8a8
13 changed files with 141 additions and 303 deletions
|
@ -793,29 +793,21 @@ void migrate_send_rp_resume_ack(MigrationIncomingState *mis, uint32_t value)
|
|||
|
||||
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
|
||||
{
|
||||
MigrationCapabilityStatusList *head = NULL;
|
||||
MigrationCapabilityStatusList *caps;
|
||||
MigrationCapabilityStatusList *head = NULL, **tail = &head;
|
||||
MigrationCapabilityStatus *caps;
|
||||
MigrationState *s = migrate_get_current();
|
||||
int i;
|
||||
|
||||
caps = NULL; /* silence compiler warning */
|
||||
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
|
||||
#ifndef CONFIG_LIVE_BLOCK_MIGRATION
|
||||
if (i == MIGRATION_CAPABILITY_BLOCK) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (head == NULL) {
|
||||
head = g_malloc0(sizeof(*caps));
|
||||
caps = head;
|
||||
} else {
|
||||
caps->next = g_malloc0(sizeof(*caps));
|
||||
caps = caps->next;
|
||||
}
|
||||
caps->value =
|
||||
g_malloc(sizeof(*caps->value));
|
||||
caps->value->capability = i;
|
||||
caps->value->state = s->enabled_capabilities[i];
|
||||
caps = g_malloc0(sizeof(*caps));
|
||||
caps->capability = i;
|
||||
caps->state = s->enabled_capabilities[i];
|
||||
QAPI_LIST_APPEND(tail, caps);
|
||||
}
|
||||
|
||||
return head;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue