[libvirt] [PATCH 2/9] util: json: Add virJSONValueIsObject

Peter Krempa pkrempa at redhat.com
Tue Jun 27 16:05:10 UTC 2017


On Tue, Jun 27, 2017 at 17:55:40 +0200, Bjoern Walk wrote:
> Peter Krempa <pkrempa at redhat.com> [2017-06-27, 02:46PM +0200]:
> > Allows testing whether a virJSONValue is an object.
> > ---
> >  src/libvirt_private.syms |  1 +
> >  src/util/virjson.c       | 10 ++++++++++
> >  src/util/virjson.h       |  2 ++
> >  3 files changed, 13 insertions(+)

[...]

> > diff --git a/src/util/virjson.c b/src/util/virjson.c
> > index b49b29b0f..efd6c3a0e 100644
> > --- a/src/util/virjson.c
> > +++ b/src/util/virjson.c
> > @@ -905,6 +905,16 @@ virJSONValueObjectGetValue(virJSONValuePtr object,
> > 
> > 
> >  bool
> > +virJSONValueIsObject(virJSONValuePtr object)
> > +{
> > +    if (object)
> > +        return object->type == VIR_JSON_TYPE_OBJECT;
> > +    else
> > +        return NULL;
> 
> s/NULL/false/

Thanks! It's a shame we don't have 'nullptr' like functionality in C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170627/b291013c/attachment-0001.sig>


More information about the libvir-list mailing list