xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/3] libxl: introduce libxl__json_array_count
Date: Tue, 7 Jun 2016 12:24:00 +0100	[thread overview]
Message-ID: <1465298642-5356-2-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1465298642-5356-1-git-send-email-wei.liu2@citrix.com>

It returns the number of elements in a json array.

It will be used later.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_json.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index ae16c25..38ec54d 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1979,6 +1979,7 @@ _hidden int libxl__json_object_append_to(libxl__gc *gc_opt,
                                          libxl__yajl_ctx *ctx);
 _hidden libxl__json_object *libxl__json_array_get(const libxl__json_object *o,
                                                   int i);
+_hidden unsigned int libxl__json_array_count(const libxl__json_object *o);
 _hidden
 libxl__json_map_node *libxl__json_map_node_get(const libxl__json_object *o,
                                                int i);
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index b60ae2b..3b744fb 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -546,6 +546,17 @@ void libxl__json_object_free(libxl__gc *gc, libxl__json_object *obj)
     free(obj);
 }
 
+unsigned int libxl__json_array_count(const libxl__json_object *o)
+{
+    flexarray_t *array = NULL;
+
+    assert(libxl__json_object_is_array(o));
+    array = libxl__json_object_get_array(o);
+    assert(array);
+
+    return array->count;
+}
+
 libxl__json_object *libxl__json_array_get(const libxl__json_object *o, int i)
 {
     flexarray_t *array = NULL;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-07 11:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 11:23 [PATCH 0/3] libxl: update available vcpus map in retrieve configuration function Wei Liu
2016-06-07 11:24 ` Wei Liu [this message]
2016-06-07 11:24 ` [PATCH 2/3] libxl: introduce libxl__qmp_query_cpus Wei Liu
2016-06-07 11:24 ` [PATCH 3/3] libxl: update vcpus bitmap in retrieved guest config Wei Liu
2016-06-07 14:45   ` Anthony PERARD
2016-06-07 16:03     ` Wei Liu
2016-06-07 16:22       ` Dario Faggioli
2016-06-07 16:46         ` Wei Liu
2016-06-07 17:05           ` Dario Faggioli
2016-06-07 16:36       ` Anthony PERARD
2016-06-07 16:39         ` Wei Liu
2016-06-14 16:31   ` Ian Jackson
2016-06-14 16:39     ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465298642-5356-2-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=anthony.perard@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).