Eric Blake <[email protected]> writes:
> On 04/27/2017 06:50 AM, Markus Armbruster wrote:
>
>>>>>
>>>>> It would be more obvious with a check for qobject_type(tos->obj), no?
>>>>
>>>> --verbose?
>>>>
>>>
>>> Instead of assert(tos->h) assert(qobject_type(tos->obj) == QTYPE_QDICT) ?
>>
>> The two conditions imply each other. We can assert either one, or even
>> both. Eric, got a preference?
>
> Asserting both might make it easier to come up to speed when reading the
> code a year from now.
All right, squashing this:
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 68a6742..d0f0002 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -296,7 +296,7 @@ static void qobject_input_end_struct(Visitor *v, void **obj)
QObjectInputVisitor *qiv = to_qiv(v);
StackObject *tos = QSLIST_FIRST(&qiv->stack);
- assert(tos->h);
+ assert(qobject_type(tos->obj) == QTYPE_QDICT && tos->h);
qobject_input_pop(v, obj);
}
@@ -360,7 +360,7 @@ static void qobject_input_end_list(Visitor *v, void **obj)
QObjectInputVisitor *qiv = to_qiv(v);
StackObject *tos = QSLIST_FIRST(&qiv->stack);
- assert(!tos->h);
+ assert(qobject_type(tos->obj) == QTYPE_QLIST && !tos->h);
qobject_input_pop(v, obj);
}