From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiAMB-0000B4-Fk for qemu-devel@nongnu.org; Thu, 30 May 2013 17:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiAM6-00010i-OY for qemu-devel@nongnu.org; Thu, 30 May 2013 17:25:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiAM6-00010b-Ao for qemu-devel@nongnu.org; Thu, 30 May 2013 17:25:54 -0400 Message-ID: <51A7C3DF.9030400@redhat.com> Date: Thu, 30 May 2013 15:25:51 -0600 From: Eric Blake MIME-Version: 1.0 References: <1369907728-4175-1-git-send-email-wdongxu@linux.vnet.ibm.com> <1369907728-4175-3-git-send-email-wdongxu@linux.vnet.ibm.com> In-Reply-To: <1369907728-4175-3-git-send-email-wdongxu@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2LGDHTIGIAOENVCUMFIHI" Subject: Re: [Qemu-devel] [PATCH V15 2/6] avoid duplication of default value in QemuOpts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dongxu Wang Cc: qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2LGDHTIGIAOENVCUMFIHI Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/30/2013 03:55 AM, Dongxu Wang wrote: > From: Dong Xu Wang >=20 > This patch will move the default value entirely to QemuOptDesc. >=20 > When getting the value of an option that hasn't been set, and > QemuOptDesc has a default value, return that. Else, behave as > before. >=20 > Example: qemu_opt_get_number(opts, "foo", 42) >=20 > If "foo" has been set in opts, return its value. >=20 > Else, if opt's QemuOptDesc has a default value for "foo", return > that. >=20 > Else, return 42. >=20 > Note that the last argument is useless when QemuOptDesc has a > default value. Ugly. If it bothers us, we could assert. >=20 > Example: qemu_opt_get(opts, "bar") >=20 > If "bar" has been set in opts, return its value. >=20 > Else, if opt's QemuOptDesc has a default value for "bar", return > that. >=20 > Else, return NULL. >=20 > Signed-off-by: Dong Xu Wang >=20 > v13->v14: > 1) change code style. > 2) assert errors. > Signed-off-by: Dongxu Wang Again, a bit of a mess at the tail of the commit message. > --- > util/qemu-option.c | 66 ++++++++++++++++++++++++++++++++++++++++------= -------- > 1 file changed, 49 insertions(+), 17 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2LGDHTIGIAOENVCUMFIHI 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRp8PfAAoJEKeha0olJ0Nqk9oH+gMabKvV7MMT5e7ArsJ/0DEp 5X+g9LeZxpiNuqXMsKIcLFpnIGgC0efSyzsXJ/hr6o6TlPbVADYSj1D3C39bwRqz yrAJfbbMgjfT5yDhk54LPsK/JgJure0xERNqdnFdxfUDVg5pgdg7m9wN0zqV7DYW HQEP9eTp+dY2jHHKStwQj13e4u7prfPZt4H70rjxIBnn6fKIMxyArLBdGZeyQMMr AQ0GS1As/nGc/E95Va3sQ/rg69ZpE8GkgCZtGcXgxjhKx1Ze0KbwXJOmRsA/EEfF tP2fmIAbFBDBxvvLj8xNdYLVrQVuH00dd4P5jmEc4eqInejsYMuAm+x6wNiPRlQ= =3k1x -----END PGP SIGNATURE----- ------enig2LGDHTIGIAOENVCUMFIHI--