diff options
author | Eric Blake | 2021-01-13 23:10:12 +0100 |
---|---|---|
committer | Markus Armbruster | 2021-01-28 08:08:45 +0100 |
commit | c3033fd372fdaf5b89190136a74b3d78880b85d6 (patch) | |
tree | 6c2464ae3f51b43702c448606acb3a6c21b6b634 /scsi | |
parent | qapi: Introduce QAPI_LIST_APPEND (diff) | |
download | qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.tar.gz qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.tar.xz qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.zip |
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>
Diffstat (limited to 'scsi')
-rw-r--r-- | scsi/pr-manager.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c index 32b9287e68..2098d7e759 100644 --- a/scsi/pr-manager.c +++ b/scsi/pr-manager.c @@ -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; } |