mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-23 06:23:10 +00:00
util: typedparam: Introduce 'virTypedParamListConcat'
Introduce a helper function to concatenate two virTypedParamLists. This will allow us to refactor qemuDomainGetStatsBlock to not access the list directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
0d09e79b42
commit
e3dff704bf
@ -3555,6 +3555,7 @@ virTypedParamListAddLLong;
|
|||||||
virTypedParamListAddString;
|
virTypedParamListAddString;
|
||||||
virTypedParamListAddUInt;
|
virTypedParamListAddUInt;
|
||||||
virTypedParamListAddULLong;
|
virTypedParamListAddULLong;
|
||||||
|
virTypedParamListConcat;
|
||||||
virTypedParamListFree;
|
virTypedParamListFree;
|
||||||
virTypedParamListFromParams;
|
virTypedParamListFromParams;
|
||||||
virTypedParamListNew;
|
virTypedParamListNew;
|
||||||
|
@ -712,6 +712,29 @@ virTypedParamListNew(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virTypedParamListConcat:
|
||||||
|
* @to: typed param list to concatenate into
|
||||||
|
* @fromptr: pointer to pointer to a typed param list to concatenate into @to
|
||||||
|
*
|
||||||
|
* Concatenates all params from the virTypedParamList pointed to by @fromptr
|
||||||
|
* into @to and deallocates the list pointed to by @fromptr and clears the
|
||||||
|
* variable.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
virTypedParamListConcat(virTypedParamList *to,
|
||||||
|
virTypedParamList **fromptr)
|
||||||
|
{
|
||||||
|
g_autoptr(virTypedParamList) from = g_steal_pointer(fromptr);
|
||||||
|
|
||||||
|
VIR_RESIZE_N(to->par, to->par_alloc, to->npar, from->npar);
|
||||||
|
|
||||||
|
memcpy(to->par + to->npar, from->par, sizeof(*(to->par)) * from->npar);
|
||||||
|
to->npar += from->npar;
|
||||||
|
from->npar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virTypedParamListFree(virTypedParamList *list)
|
virTypedParamListFree(virTypedParamList *list)
|
||||||
{
|
{
|
||||||
|
@ -156,6 +156,10 @@ virTypedParamList *
|
|||||||
virTypedParamListFromParams(virTypedParameterPtr *params,
|
virTypedParamListFromParams(virTypedParameterPtr *params,
|
||||||
size_t nparams);
|
size_t nparams);
|
||||||
|
|
||||||
|
void
|
||||||
|
virTypedParamListConcat(virTypedParamList *to,
|
||||||
|
virTypedParamList **fromptr);
|
||||||
|
|
||||||
int
|
int
|
||||||
virTypedParamListAddInt(virTypedParamList *list,
|
virTypedParamListAddInt(virTypedParamList *list,
|
||||||
int value,
|
int value,
|
||||||
|
Loading…
Reference in New Issue
Block a user