Re: [Qemu-devel] [RFC 02/15] qobject: allow NULL for qstring_get_str()

2017-09-19 Thread Peter Xu
On Tue, Sep 19, 2017 at 03:48:35PM -0500, Eric Blake wrote: > On 09/14/2017 02:50 AM, Peter Xu wrote: > > Then I can get NULL rather than crash when calling things like: > > > > qstring_get_str(qobject_to_qstring(object)); > > > > when key does not exist. > > Right now, qdict_get_str() is docu

Re: [Qemu-devel] [RFC 02/15] qobject: allow NULL for qstring_get_str()

2017-09-19 Thread Eric Blake
On 09/14/2017 02:50 AM, Peter Xu wrote: > Then I can get NULL rather than crash when calling things like: > > qstring_get_str(qobject_to_qstring(object)); > > when key does not exist. Right now, qdict_get_str() is documented as: * This function assumes that 'key' exists and it stores a * QS

[Qemu-devel] [RFC 02/15] qobject: allow NULL for qstring_get_str()

2017-09-14 Thread Peter Xu
Then I can get NULL rather than crash when calling things like: qstring_get_str(qobject_to_qstring(object)); when key does not exist. CC: Markus Armbruster Signed-off-by: Peter Xu --- qobject/qstring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qobject/qstring.c b/q