[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] qobject/qjson.c:69: failed assertion `obj != NULL'

From: Paolo Bonzini
Subject: Re: [Qemu-devel] qobject/qjson.c:69: failed assertion `obj != NULL'
Date: Tue, 22 Nov 2016 07:54:33 -0500 (EST)

> > 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]