Received: from eggs.gnu.org ([2001:4830:134:3::10]:48009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b88rM-0002wq-Qq for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:19:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b88rJ-0003vk-HA for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:19:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b88rJ-0003ve-BO for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:19:05 -0400 From: Markus Armbruster References: <1463632874-28559-1-git-send-email-eblake@redhat.com> <1463632874-28559-9-git-send-email-eblake@redhat.com> Date: Wed, 01 Jun 2016 18:19:02 +0200 In-Reply-To: <1463632874-28559-9-git-send-email-eblake@redhat.com> (Eric Blake's message of "Wed, 18 May 2016 22:40:54 -0600") Message-ID: <87a8j4q3ux.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 08/28] qmp-input-visitor: Favor new visit_free() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth , Gerd Hoffmann , Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= Eric Blake writes: > Now that we have a polymorphic visit_free(), we no longer need > qmp_input_visitor_cleanup(); which in turn means we no longer > need to return a subtype from qmp_input_visitor_new() nor a > public upcast function. > > Generated code changes to qmp-marshal look like: qmp-marshal.c > > |@@ -52,11 +52,10 @@ void qmp_marshal_add_fd(QDict *args, QOb > | { > | Error *err = NULL; > | AddfdInfo *retval; > |- QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true); > | Visitor *v; > | q_obj_add_fd_arg arg = {0}; > | > |- v = qmp_input_get_visitor(qiv); > |+ v = qmp_input_visitor_new(QOBJECT(args), true); > | visit_start_struct(v, NULL, NULL, 0, &err); > | if (err) { > | goto out; > > Signed-off-by: Eric Blake [...] > diff --git a/tests/check-qnull.c b/tests/check-qnull.c > index fd9c68f..c8021dc 100644 > --- a/tests/check-qnull.c > +++ b/tests/check-qnull.c > @@ -39,7 +39,7 @@ static void qnull_visit_test(void) > { > QObject *obj; > QmpOutputVisitor *qov; > - QmpInputVisitor *qiv; > + Visitor *qiv; Call it v instead of qiv? You do that elsewhere... Your choice. > > /* > * Most tests of interactions between QObject and visitors are in > @@ -51,8 +51,8 @@ static void qnull_visit_test(void) > obj = qnull(); > qiv = qmp_input_visitor_new(obj, true); > qobject_decref(obj); > - visit_type_null(qmp_input_get_visitor(qiv), NULL, &error_abort); > - qmp_input_visitor_cleanup(qiv); > + visit_type_null(qiv, NULL, &error_abort); > + visit_free(qiv); > > qov = qmp_output_visitor_new(); > visit_type_null(qmp_output_get_visitor(qov), NULL, &error_abort); [...]