From: Wei Liu Date: Tue, 13 May 2014 21:53:56 +0000 (+0100) Subject: libxl_internal.h: introduce libxl__json_object_is_{null, number, double} X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4972 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7dd6000671ca38e0d31f07e2d09c59e0241287c8;p=xen.git libxl_internal.h: introduce libxl__json_object_is_{null, number, double} ... which return true if json object is valid and of type JSON_{NULL,NUMBER,DOUBLE}. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 890678743d..325d340774 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1647,6 +1647,10 @@ typedef struct { typedef struct libxl__yajl_ctx libxl__yajl_ctx; +static inline bool libxl__json_object_is_null(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_NULL; +} static inline bool libxl__json_object_is_bool(const libxl__json_object *o) { return o != NULL && o->type == JSON_BOOL; @@ -1659,6 +1663,14 @@ static inline bool libxl__json_object_is_integer(const libxl__json_object *o) { return o != NULL && o->type == JSON_INTEGER; } +static inline bool libxl__json_object_is_double(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_DOUBLE; +} +static inline bool libxl__json_object_is_number(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_NUMBER; +} static inline bool libxl__json_object_is_map(const libxl__json_object *o) { return o != NULL && o->type == JSON_MAP;