mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
qapi: Make more of qobject_to()
This patch reworks some places which use either qobject_type() checks plus qobject_to(), where the latter alone is sufficient, or NULL checks plus qobject_type() checks where we can simply do a qobject_to() != NULL check. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20180224154033.29559-6-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: rebase to qobject_to() parameter ordering] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
cb51b976ba
commit
532fb53284
3 changed files with 20 additions and 17 deletions
|
@ -339,7 +339,7 @@ static GenericList *qobject_input_next_list(Visitor *v, GenericList *tail,
|
|||
QObjectInputVisitor *qiv = to_qiv(v);
|
||||
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
||||
|
||||
assert(tos && tos->obj && qobject_type(tos->obj) == QTYPE_QLIST);
|
||||
assert(tos && qobject_to(QList, tos->obj));
|
||||
|
||||
if (!tos->entry) {
|
||||
return NULL;
|
||||
|
@ -353,7 +353,7 @@ static void qobject_input_check_list(Visitor *v, Error **errp)
|
|||
QObjectInputVisitor *qiv = to_qiv(v);
|
||||
StackObject *tos = QSLIST_FIRST(&qiv->stack);
|
||||
|
||||
assert(tos && tos->obj && qobject_type(tos->obj) == QTYPE_QLIST);
|
||||
assert(tos && qobject_to(QList, tos->obj));
|
||||
|
||||
if (tos->entry) {
|
||||
error_setg(errp, "Only %u list elements expected in %s",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue