From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1admMv-00014m-FC for qemu-devel@nongnu.org; Wed, 09 Mar 2016 17:14:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1admMu-0000cr-Bz for qemu-devel@nongnu.org; Wed, 09 Mar 2016 17:14:13 -0500 References: <1457502997-30904-1-git-send-email-peterx@redhat.com> <1457502997-30904-2-git-send-email-peterx@redhat.com> From: Eric Blake Message-ID: <56E0A02B.50102@redhat.com> Date: Wed, 9 Mar 2016 15:14:03 -0700 MIME-Version: 1.0 In-Reply-To: <1457502997-30904-2-git-send-email-peterx@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8dc5xJCLud1opJViwX3qxLC2OTKhrWrTo" Subject: Re: [Qemu-devel] [PATCH 1/2] block/qapi: make two printf() formats literal List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu , qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8dc5xJCLud1opJViwX3qxLC2OTKhrWrTo Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/08/2016 10:56 PM, Peter Xu wrote: > Fix two places to use literal printf format when possible. >=20 > Signed-off-by: Peter Xu > --- > block/qapi.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) Reviewed-by: Eric Blake >=20 > diff --git a/block/qapi.c b/block/qapi.c > index db2d3fb..c4c2115 100644 > --- a/block/qapi.c > +++ b/block/qapi.c > @@ -619,9 +619,8 @@ static void dump_qlist(fprintf_function func_fprint= f, void *f, int indentation, > for (entry =3D qlist_first(list); entry; entry =3D qlist_next(entr= y), i++) { > QType type =3D qobject_type(entry->value); > bool composite =3D (type =3D=3D QTYPE_QDICT || type =3D=3D QTY= PE_QLIST); > - const char *format =3D composite ? "%*s[%i]:\n" : "%*s[%i]: ";= > - > - func_fprintf(f, format, indentation * 4, "", i); > + func_fprintf(f, "%*s[%i]:%c", indentation * 4, "", i, > + composite ? '\n' : ' '); [The nerd in me wants to point out that you could avoid the ternary by writing '"\n "[composite]', but that's too ugly to use outside of IOCCC submissions, and I wouldn't be surprised if it (rightfully) triggers clang warnings] --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --8dc5xJCLud1opJViwX3qxLC2OTKhrWrTo 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/ iQEcBAEBCAAGBQJW4KArAAoJEKeha0olJ0NqkskH/11MMZHR3Hn+YQS80Hg+2jj6 UAvqVxX78AbnImuuKCEZlYZugHxOfmT/tHNJRa9BHssVwulOUAhTNDzPc0VqOIVZ FxW17+ma74P/JqHZYGgMI7g0mOwyQ/lfHcpS3d2nV5yiUVqz4fgKvC9nJbjbY2vq Sv79TS5NP8mXuhONZr0sVcmKEpPep3S+RKu3omgHGaiP5zAOl36Sow9bGfaD34z3 1fX+kgNnOTMmyKQ941osRNpZg/oakWFZW/sP8bCbFdvIOUYhvsFKeMc9yaaWb3hu wBrKmlQXPOjtxLbdFk2KxpXlXG4Fj8GakVTO+QuGO9K3/5q72s0i3FKAE8CmREg= =2JWx -----END PGP SIGNATURE----- --8dc5xJCLud1opJViwX3qxLC2OTKhrWrTo--