mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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
|
@ -1885,7 +1885,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
|
|||
{
|
||||
QCryptoBlockLUKS *luks = block->opaque;
|
||||
QCryptoBlockInfoLUKSSlot *slot;
|
||||
QCryptoBlockInfoLUKSSlotList *slots = NULL, **prev = &info->u.luks.slots;
|
||||
QCryptoBlockInfoLUKSSlotList **tail = &info->u.luks.slots;
|
||||
size_t i;
|
||||
|
||||
info->u.luks.cipher_alg = luks->cipher_alg;
|
||||
|
@ -1902,10 +1902,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
|
|||
sizeof(luks->header.uuid));
|
||||
|
||||
for (i = 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) {
|
||||
slots = g_new0(QCryptoBlockInfoLUKSSlotList, 1);
|
||||
*prev = slots;
|
||||
|
||||
slots->value = slot = g_new0(QCryptoBlockInfoLUKSSlot, 1);
|
||||
slot = g_new0(QCryptoBlockInfoLUKSSlot, 1);
|
||||
slot->active = luks->header.key_slots[i].active ==
|
||||
QCRYPTO_BLOCK_LUKS_KEY_SLOT_ENABLED;
|
||||
slot->key_offset = luks->header.key_slots[i].key_offset_sector
|
||||
|
@ -1917,7 +1914,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
|
|||
slot->stripes = luks->header.key_slots[i].stripes;
|
||||
}
|
||||
|
||||
prev = &slots->next;
|
||||
QAPI_LIST_APPEND(tail, slot);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue