mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +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;
|
||||
virTypedParamListAddUInt;
|
||||
virTypedParamListAddULLong;
|
||||
virTypedParamListConcat;
|
||||
virTypedParamListFree;
|
||||
virTypedParamListFromParams;
|
||||
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
|
||||
virTypedParamListFree(virTypedParamList *list)
|
||||
{
|
||||
|
@ -156,6 +156,10 @@ virTypedParamList *
|
||||
virTypedParamListFromParams(virTypedParameterPtr *params,
|
||||
size_t nparams);
|
||||
|
||||
void
|
||||
virTypedParamListConcat(virTypedParamList *to,
|
||||
virTypedParamList **fromptr);
|
||||
|
||||
int
|
||||
virTypedParamListAddInt(virTypedParamList *list,
|
||||
int value,
|
||||
|
Loading…
x
Reference in New Issue
Block a user