aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/flexarray.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-03-09 17:03:34 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2011-03-09 17:03:34 +0000
commit8f53c184ea06bb1f060ce9ad30bc24893ff9c950 (patch)
tree80c2d729120e4ba3adb9bac40322b95bdebd9f97 /tools/libxl/flexarray.c
parent54f4cfa3d8c60fa81dbb28fc83bf5f2272ed4222 (diff)
downloadxen-8f53c184ea06bb1f060ce9ad30bc24893ff9c950.tar.gz
xen-8f53c184ea06bb1f060ce9ad30bc24893ff9c950.tar.bz2
xen-8f53c184ea06bb1f060ce9ad30bc24893ff9c950.zip
libxl: introduce flexarray_append_pair
Introduce flexarray_append_pair: a simple syntactic sugar to add a pair of pointers to a flexarray, very useful when adding pairs of strings to xenstore. Replace flexarray_vappend calls (and one pair of flexarray_append) with flexarray_append_pair calls when dealing with flexarrays that are going to be used with libxl__xs_kvs_of_flexarray: NULL is a valid pointer value in these cases while flexarray_vappend uses NULL as vargs terminator, so the old code is buggy. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/flexarray.c')
-rw-r--r--tools/libxl/flexarray.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/libxl/flexarray.c b/tools/libxl/flexarray.c
index 724eabd52f..c89c23e159 100644
--- a/tools/libxl/flexarray.c
+++ b/tools/libxl/flexarray.c
@@ -69,6 +69,14 @@ int flexarray_append(flexarray_t *array, void *ptr)
return flexarray_set(array, array->count, ptr);
}
+int flexarray_append_pair(flexarray_t *array, void *ptr1, void *ptr2)
+{
+ int rc = flexarray_append(array, ptr1);
+ if (!rc)
+ rc = flexarray_append(array, ptr2);
+ return rc;
+}
+
int flexarray_vappend(flexarray_t *array, ...)
{
va_list va;