qapi: Use QAPI_LIST_APPEND in trivial cases
The easiest spots to use QAPI_LIST_APPEND are where we already have an obvious pointer to the tail of a list. While at it, consistently use the variable name 'tail' for that purpose. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210113221013.390592-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
dc13f40c6b
commit
c3033fd372
20 changed files with 96 additions and 222 deletions
|
|
@ -116,8 +116,7 @@ pr_manager_register_types(void)
|
|||
|
||||
static int query_one_pr_manager(Object *object, void *opaque)
|
||||
{
|
||||
PRManagerInfoList ***prev = opaque;
|
||||
PRManagerInfoList *elem;
|
||||
PRManagerInfoList ***tail = opaque;
|
||||
PRManagerInfo *info;
|
||||
PRManager *pr_mgr;
|
||||
|
||||
|
|
@ -126,15 +125,10 @@ static int query_one_pr_manager(Object *object, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
elem = g_new0(PRManagerInfoList, 1);
|
||||
info = g_new0(PRManagerInfo, 1);
|
||||
info->id = g_strdup(object_get_canonical_path_component(object));
|
||||
info->connected = pr_manager_is_connected(pr_mgr);
|
||||
elem->value = info;
|
||||
elem->next = NULL;
|
||||
|
||||
**prev = elem;
|
||||
*prev = &elem->next;
|
||||
QAPI_LIST_APPEND(*tail, info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue