Received: from eggs.gnu.org ([2001:4830:134:3::10]:55121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw483-0000Rt-7W for qemu-devel@nongnu.org; Fri, 29 Apr 2016 04:50:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw47z-0000nU-02 for qemu-devel@nongnu.org; Fri, 29 Apr 2016 04:50:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw47y-0000nA-RI for qemu-devel@nongnu.org; Fri, 29 Apr 2016 04:50:22 -0400 From: Markus Armbruster References: <1461879932-9020-1-git-send-email-eblake@redhat.com> <1461879932-9020-12-git-send-email-eblake@redhat.com> Date: Fri, 29 Apr 2016 10:50:19 +0200 In-Reply-To: <1461879932-9020-12-git-send-email-eblake@redhat.com> (Eric Blake's message of "Thu, 28 Apr 2016 15:45:19 -0600") Message-ID: <87a8kc7q9g.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v16 11/24] qmp-input: Refactor when list is advanced List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > In the QMP input visitor, visiting a list traverses two objects: > the QAPI GenericList of the caller (which gets advanced in > visit_next_list() regardless of this patch), and the QList input > that we are converting to QAPI. For consistency with QDict > visits, we want to consume elements from the input QList during > the visit_type_FOO() for the list element; that is, we want ALL > the code for consuming an input to live in qmp_input_get_object(), > rather than having it split according to whether we are visiting > a dict or a list. Making qmp_input_get_object() the common point > of consumption will make it easier for a later patch to refactor > visit_start_list() to cover the GenericList * head of a QAPI list, > and in turn will get rid of the 'first' flag (which lived in > qmp_input_next_list() pre-patch, and is hoisted to StackObject > by this patch). > > This patch is therefore shifting the post-condition use of > 'entry' from: > > start_list next_list type_ELT ... next_list type_ELT next_list end_list > visit 1st elt last elt > entry NULL 1st elt 1st elt last elt last elt NULL gone You added a line "visit", but the introduction still only mentions 'entry'. Mildly confusing. If you have an idea on how to improve it, I can touch it up on commit. > > where type_ELT() returns (entry ? entry : 1st elt) and next_list() steps > entry > > to this usage: > > start_list next_list type_ELT ... next_list type_ELT next_list end_list > visit 1st elt last elt > entry 1st elt 1nd elt 2nd elt last elt NULL NULL gone > > where type_ELT() steps entry and returns the old entry, and next_list() > leaves entry alone. > > Signed-off-by: Eric Blake Patch looks good.