On a Wednesday in 2023, Peter Krempa wrote:
Introduce a helper that fetches the typed parameters from the list
while
still preserving ownership of the pointer by the list.
In the future this will be also able to report errors stored in the
list.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com
---
src/libvirt_private.syms | 1 +
src/util/virtypedparam.c | 26 ++++++++++++++++++++++++++
src/util/virtypedparam.h | 6 ++++++
3 files changed, 33 insertions(+)
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index f8dce9ed98..6e837c65bc 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -747,6 +747,32 @@ virTypedParamListFree(virTypedParamList *list)
}
+/**
+ * virTypedParamListFetch:
+ *
+ * @list: virTypedParamList object
+ * @par: if not NULL filled with the typed parameters stored in @list
+ * @npar: if not NULL filled with the number of typed parameters stored in @list
+ *
+ * Checks that @list has no errors stored and optionally fills @par and @npar
+ * with a valid list of typed parametes. The typed parameters still belong to
*parameters
+ * @list and will be freed together.
+ */
Jano