From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9Aat-0002su-Kt for qemu-devel@nongnu.org; Tue, 22 Nov 2016 07:54:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9Aaq-0002mT-KX for qemu-devel@nongnu.org; Tue, 22 Nov 2016 07:54:39 -0500 Received: from mx5-phx2.redhat.com ([209.132.183.37]:44506) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c9Aaq-0002l4-CB for qemu-devel@nongnu.org; Tue, 22 Nov 2016 07:54:36 -0500 Date: Tue, 22 Nov 2016 07:54:33 -0500 (EST) From: Paolo Bonzini Message-ID: <442795206.1194764.1479819273263.JavaMail.zimbra@redhat.com> In-Reply-To: References: <673F175E-AF65-4F4F-9895-C7335A36AC29@gmail.com> <8b136de6-490a-d194-b7a6-eabfb87daf2c@redhat.com> <16AF327F-E1FE-4F2E-9919-A474276474FF@gmail.com> <182f25fb-98bd-73db-62f3-ff18b30a49cd@redhat.com> <3c5fdd4e-da35-46d9-9c64-a1a269f41646@redhat.com> <87twaz3k2h.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] qobject/qjson.c:69: failed assertion `obj != NULL' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Markus Armbruster , G 3 , qemu-devel qemu-devel > > I kind of like the %-escapes, because they provide a compact and legible > > way to build QObjects. But with so little use, they're hardly earning > > their keep. > > What drives me most insane about them is that they are NOT the same > escapes as printf(), so the compiler can't help us with type safety, and > things like PRId64 don't always do what we want. And except for %p for > injecting nested objects, most of our escapes are just as easy to > perform with g_strdup_printf() (injecting a string, integer, or > boolean), or by manual creation of the QDict. Oh wait. Now I remember where we most used %-escapes and they're actually much more useful and pervasive than you estimated. See commit 563890c ("libqtest: escape strings in QMP commands, fix leak", 2014-07-01); they cannot be produced with g_strdup_printf, because %s automatically escapes strings. The patch actually fixed a failure in qom-test, if I'm not mistaken, due to a " appearing in a QOM path. However, I'm still in favor of limiting % to the testsuite. Paolo