[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6 14/18] libxl: introduce libxl_key_value_list_length
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/libxl.c | 13 +++++++++++++ tools/libxl/libxl.h | 1 + 2 files changed, 14 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 0ce9153..a5ed1e2 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -216,6 +216,19 @@ 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 1fad0d2..3e3d913 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -567,6 +567,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 |