]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: typedparam: Introduce virTypedParamListFromParams
authorPeter Krempa <pkrempa@redhat.com>
Wed, 18 May 2022 08:46:52 +0000 (10:46 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 May 2022 11:46:30 +0000 (13:46 +0200)
The helper constructs a virTypedParamList from loose params.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/libvirt_private.syms
src/util/virtypedparam.c
src/util/virtypedparam.h

index d95c1817930cdf7dcb47f06344bc2199614eaa09..3711e33cf55eadab6537dd1948dfa5303c6bbe16 100644 (file)
@@ -3493,6 +3493,7 @@ virTypedParamListAddString;
 virTypedParamListAddUInt;
 virTypedParamListAddULLong;
 virTypedParamListFree;
+virTypedParamListFromParams;
 virTypedParamListStealParams;
 virTypedParamsCheck;
 virTypedParamsCopy;
index aa6a8710494dd04bf3794e094831e622c7286340..2d7e4ab35470f0f99485a65b01daf78505fa8d5f 100644 (file)
@@ -738,6 +738,19 @@ virTypedParamListStealParams(virTypedParamList *list,
     return ret;
 }
 
+virTypedParamList *
+virTypedParamListFromParams(virTypedParameterPtr *params,
+                            size_t nparams)
+{
+    virTypedParamList *l = g_new0(virTypedParamList, 1);
+
+    l->par = g_steal_pointer(params);
+    l->npar = nparams;
+    l->par_alloc = nparams;
+
+    return l;
+}
+
 
 static int G_GNUC_PRINTF(2, 0)
 virTypedParamSetNameVPrintf(virTypedParameterPtr par,
index f4b3921c381c73a0117bffde7a9f4df2ccba47f4..c4bc58ee8f6aeb8abb74824c7ad15f691fe25f96 100644 (file)
@@ -138,6 +138,10 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virTypedParamList, virTypedParamListFree);
 size_t virTypedParamListStealParams(virTypedParamList *list,
                                     virTypedParameterPtr *params);
 
+virTypedParamList *
+virTypedParamListFromParams(virTypedParameterPtr *params,
+                            size_t nparams);
+
 int virTypedParamListAddInt(virTypedParamList *list,
                             int value,
                             const char *namefmt,