On 01/05/2016 07:05 AM, Marc-André Lureau wrote: > Hi > > On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <ebl...@redhat.com> wrote: >> Add a new qmp_output_visitor_reset(), which must be called before >> reusing an exising QmpOutputVisitor on a new root object. Tighten >> assertions to require that qmp_output_get_qobject() can only be >> called after pairing a visit_end_* for every visit_start_* (rather >> than allowing it to return a partially built object), that it must >> not be called unless at least one visit_type_* or visit_start/ >> visit_end pair has occurred since creation/reset (the accidental >> return of NULL fixed by commit ab8bf1d7 would have been much >> easier to diagnose), and that it may only be called once per visit. >> >> To keep the semantics of test_visitor_out_empty, we now have to >> explicitly request a top-level visit of a NULL object, by >> implementing the just-added visitor type_null() callback. >> >> Signed-off-by: Eric Blake <ebl...@redhat.com> >>
>> -void qmp_output_visitor_cleanup(QmpOutputVisitor *v) >> +void qmp_output_visitor_reset(QmpOutputVisitor *v) >> { >> QStackEntry *e, *tmp; >> >> @@ -231,6 +235,12 @@ void qmp_output_visitor_cleanup(QmpOutputVisitor *v) >> } >> >> qobject_decref(v->root); >> + v->root = NULL; >> +} >> + >> +void qmp_output_visitor_cleanup(QmpOutputVisitor *v) > > It would make sense to call it _free() imho.. Pre-existing name, so a cleanup should be in a separate patch. >> @@ -459,6 +460,7 @@ static void test_visitor_out_empty(TestOutputVisitorData >> *data, >> { >> QObject *arg; >> >> + visit_type_null(data->ov, NULL, &error_abort); > > I guess this is going to be used outside of just this artificial case. > Otherwise, I would have suggested to get rid of it. Used in 24/35 (in fact, it was discussion on that topic just before 2.5 that prompted me to even add visit_type_null()). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature