From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtl1R-0000O5-Ce for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:20:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vtl1M-0007zI-35 for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:20:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtl1L-0007zE-JC for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:20:39 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBJLKcfh029145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Dec 2013 16:20:38 -0500 Message-ID: <52B36325.6090809@redhat.com> Date: Thu, 19 Dec 2013 14:20:37 -0700 From: Eric Blake MIME-Version: 1.0 References: <1387482443-10633-1-git-send-email-mreitz@redhat.com> <1387482443-10633-4-git-send-email-mreitz@redhat.com> In-Reply-To: <1387482443-10633-4-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lu95rGUk4A6wSw1diEQbBCh1kDwpiwCPn" Subject: Re: [Qemu-devel] [PATCH v6 03/22] qdict: Add qdict_array_split() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lu95rGUk4A6wSw1diEQbBCh1kDwpiwCPn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/19/2013 12:47 PM, Max Reitz wrote: > This function splits a QDict consisting of entries prefixed by > incrementally enumerated indices into a QList of QDicts. >=20 > Signed-off-by: Max Reitz > Reviewed-by: Kevin Wolf > --- > include/qapi/qmp/qdict.h | 1 + > qobject/qdict.c | 36 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 37 insertions(+) > + > +/** > + * qdict_array_split(): This function creates a QList of QDicts. Every= entry in > + * the original QDict with a key prefixed "%u.", where %u designates a= n unsigned > + * integer starting at 0 and incrementally counting up, will be moved = to a new > + * QDict at index %u in the output QList with the key prefix removed. = The > + * function terminates when there is no entry in the QDict with a pref= ix > + * directly (incrementally) following the last one. > + * Example: {"0.a": 42, "0.b": 23, "1.x": 0, "3.y": 1, "o.o": 7} > + * (or {"1.x": 0, "3.y": 1, "0.a": 42, "o.o": 7, "0.b": 23}) > + * =3D> [{"a": 42, "b": 23}, {"x": 0}] > + * and {"3.y": 1, "o.o": 7} (remainder of the old QDict) It took me a read through the function to realize the "and ... (remainder)" comment refers to the input QDict, which is modified in-place as a side effect. Maybe change the first sentence to: This function moves array-like elements of a QDict into a new QList of QDicts. But that's minor, and doesn't stop me from adding: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lu95rGUk4A6wSw1diEQbBCh1kDwpiwCPn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSs2MlAAoJEKeha0olJ0NqIqoH/3rxEimh6HAUDuKIIC2zFPSJ WZXK73LKBdhyOYn7B5iHKzlUw3zwc/FcelcEhHmCbLouiLS+bEApWlpqcr0HQ6hO OKUSrVP9ntTIcWHo94S2RW1f8I//oI5l+N4e7hSJbbuYc8k0pQ1QcSp9NpCzg77H LW7IHdp6RP/wUzGECjyd9uYavUP/Kix1ogiMoKZFuMqQ8Bs4dI8WAHcsQGVpxcGX OAggJOJjVKPvsrErB9HNAeUQZVIj7KX5EQkUTUtJkeLu1JcqxDbPAPlBfwGMQ/E7 FqpYIdpXgqT+C5ICiyz4idmEuXgQDy2RjzwueiHWbppdx+24jOS7IUmdTKhkCjM= =l6xB -----END PGP SIGNATURE----- --lu95rGUk4A6wSw1diEQbBCh1kDwpiwCPn--