From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH V3 07/13] libxl_internal: introduce libxl__json_object_is_{null, number, double} Date: Wed, 23 Apr 2014 17:59:17 +0100 Message-ID: <1398272363-12133-8-git-send-email-wei.liu2@citrix.com> References: <1398272363-12133-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398272363-12133-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org ... which return true if json object is valid and of type JSON_{NULL,NUMBER,DOUBLE}. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- tools/libxl/libxl_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index f37a102..9074d40 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1655,6 +1655,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; @@ -1667,6 +1671,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; -- 1.7.10.4