mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
util: virtypedparam: Introduce 'virTypedParamListFetch'
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@redhat.com Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8ea33c8c18
commit
0fac024958
@ -3556,6 +3556,7 @@ virTypedParamListAddString;
|
||||
virTypedParamListAddUInt;
|
||||
virTypedParamListAddULLong;
|
||||
virTypedParamListConcat;
|
||||
virTypedParamListFetch;
|
||||
virTypedParamListFree;
|
||||
virTypedParamListFromParams;
|
||||
virTypedParamListNew;
|
||||
|
@ -746,6 +746,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 parameters. The typed parameters still belong to
|
||||
* @list and will be freed together.
|
||||
*/
|
||||
int
|
||||
virTypedParamListFetch(virTypedParamList *list,
|
||||
virTypedParameterPtr *par,
|
||||
size_t *npar)
|
||||
{
|
||||
if (par)
|
||||
*par = list->par;
|
||||
|
||||
if (npar)
|
||||
*npar = list->npar;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
virTypedParamListStealParams(virTypedParamList *list,
|
||||
virTypedParameterPtr *params)
|
||||
|
@ -152,6 +152,12 @@ size_t
|
||||
virTypedParamListStealParams(virTypedParamList *list,
|
||||
virTypedParameterPtr *params);
|
||||
|
||||
int
|
||||
virTypedParamListFetch(virTypedParamList *list,
|
||||
virTypedParameterPtr *par,
|
||||
size_t *npar)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
virTypedParamList *
|
||||
virTypedParamListFromParams(virTypedParameterPtr *params,
|
||||
size_t nparams);
|
||||
|
Loading…
Reference in New Issue
Block a user