From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Km-0005Xf-JE for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw7Ka-0003mp-QC for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:15:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Ka-0003j6-Iz for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:15:36 -0400 References: <1461879932-9020-1-git-send-email-eblake@redhat.com> <1461879932-9020-12-git-send-email-eblake@redhat.com> <87a8kc7q9g.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: <5723505C.9070605@redhat.com> Date: Fri, 29 Apr 2016 06:15:24 -0600 MIME-Version: 1.0 In-Reply-To: <87a8kc7q9g.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1fLR2gUIeLNbhA83TmFAtQ5bKuN1S8HvD" 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: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1fLR2gUIeLNbhA83TmFAtQ5bKuN1S8HvD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/29/2016 02:50 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> 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 >=20 > 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. [probably word wrapped by my mailer, but how about] This patch is therefore altering the post-condition use of 'entry', while keeping what gets visited unchanged, from: start_list next_list type_ELT ... next_list type_ELT next_list end_list visits 1st elt last elt entry NULL 1st elt 1st elt last elt last elt NULL g= one >=20 >> >> where type_ELT() returns (entry ? entry : 1st elt) and next_list() ste= ps >> entry >> >> to this usage: >> >> start_list next_list type_ELT ... next_list type_ELT next_list= end_list >> visit 1st elt last elt and another s/visit/visits/ here >> 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 >=20 > Patch looks good. I added the visit line to make it a little easier to see that type_ELT is still visiting the same thing, even though 'entry' ends up on a different spot (easier than deciphering "type_ELT() ... returns the old entry"). But if you don't think it adds anything, I'm also okay with dropping the 'visit[s]' line and sticking to just the phrase after the diagram for that explanation. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --1fLR2gUIeLNbhA83TmFAtQ5bKuN1S8HvD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXI1BcAAoJEKeha0olJ0Nqd9gIAKmq0InlNj9yizSBLxe/jiWA uUvWNgWdplxWHqSEE81PeXpDAUKBOsQkQb/QE1+KMWzLFVnwyH8rb3rTekFTkdFU X9jlq6BI9Iwgjg9GO+k7QUB7UHQ4MWV0mZeSg3SMiWXd/6RJbBjLINkiY8o6r39t rpYKqRD6oU6DY/a344bmTqDf3wVCGL8UyIRZPZcvt7lXN9Wo3tfQu2iUzV/IS1w2 pimHPDmx1vBR1FT64pa/GYiNMk3kC/rSI7MM22PO+L02AArPha4bAbvmEwCWKUlk pa319qZ3idJlODy/5dCjhtWctofFLmW7DdaoxHlkD5ekA/+3dhedljSs1nWZ2+I= =aG/g -----END PGP SIGNATURE----- --1fLR2gUIeLNbhA83TmFAtQ5bKuN1S8HvD--