[PATCH 1/4] util: typedparam: Introduce virTypedParamListFromParams

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The helper constructs a virTypedParamList from loose params.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/libvirt_private.syms |  1 +
 src/util/virtypedparam.c | 13 +++++++++++++
 src/util/virtypedparam.h |  4 ++++
 3 files changed, 18 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d95c181793..3711e33cf5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3493,6 +3493,7 @@ virTypedParamListAddString;
 virTypedParamListAddUInt;
 virTypedParamListAddULLong;
 virTypedParamListFree;
+virTypedParamListFromParams;
 virTypedParamListStealParams;
 virTypedParamsCheck;
 virTypedParamsCopy;
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index aa6a871049..2d7e4ab354 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -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,
diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h
index f4b3921c38..c4bc58ee8f 100644
--- a/src/util/virtypedparam.h
+++ b/src/util/virtypedparam.h
@@ -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,
-- 
2.35.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux