Received: from eggs.gnu.org ([2001:4830:134:3::10]:40689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c97yL-0006hD-BM for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:06:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c97yF-0008D5-MZ for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:06:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48800) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c97yF-0008Bb-GE for qemu-devel@nongnu.org; Tue, 22 Nov 2016 05:06:35 -0500 From: Markus Armbruster 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> Date: Tue, 22 Nov 2016 11:06:30 +0100 In-Reply-To: <3c5fdd4e-da35-46d9-9c64-a1a269f41646@redhat.com> (Eric Blake's message of "Mon, 21 Nov 2016 14:46:22 -0600") Message-ID: <87twaz3k2h.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: G 3 , Paolo Bonzini , qemu-devel qemu-devel Eric Blake writes: > On 11/21/2016 02:36 PM, Eric Blake wrote: >> The source of your problem is that your platform defines PRId64 as 'qd', >> but the qemu JSON parser only recognizes lld (POSIX) or I64d (mingw) for >> parsing 64-bit numbers. We could enhance the JSON parser to recognize >> the non-standard qd in addition to the hack we already have for mingw, Yes... >> but I'd argue that using qobject_from_jsonf() is already less-than-useful. > > In fact, we are down to only a handful of users of our modified 'jsonf' > format (that is, strings that mix JSON with % modifiers): > > hw/pci/pcie_aer.c: build a 5-element QDict > monitor.c: build a 1-element QDict which contains a 2-element QDict > qapi/qmp-dispatch.c: build a 2-element QDict > qapi/qmp-event.c: Build a 2-element QDict > > plus the testsuite (check-qjson.c). How did you find them? >> It's hard to argue that the >> complexity of maintaining our pseudo-printf JSON parser for constructing >> a QObject with one line is worth the effort compared to the three or >> four lines to construct the same QObject by hand. > > I'm severely tempted to just rip out all of the poorly-underdocumented % > parsing from the JSON parser, as it will simplify our code, without much > pain in converting the four real users to just manually build up the > same objects. 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.