[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V5 22/32] libxl: introduce libxl_key_value_list_length
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl.c | 12 ++++++++++++ tools/libxl/libxl.h | 1 + 2 files changed, 13 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 0589d4e..0a73a98 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -216,6 +216,18 @@ int libxl_string_list_length(const libxl_string_list *psl) return i; } +int libxl_key_value_list_length(libxl_key_value_list *pkvl) +{ + int i = 0; + libxl_key_value_list kvl = *pkvl; + + if (kvl) + while (kvl[2 * i]) /* Only checks keys */ + i++; + + return i; +} + void libxl_key_value_list_dispose(libxl_key_value_list *pkvl) { int i; diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 88f3b02..3886b9e 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -553,6 +553,7 @@ int libxl_string_list_length(const libxl_string_list *sl); typedef char **libxl_key_value_list; void libxl_key_value_list_dispose(libxl_key_value_list *kvl); +int libxl_key_value_list_length(libxl_key_value_list *kvl); typedef uint32_t libxl_hwcap[8]; -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |