mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
src/nwfilter: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6fca03f0a0
commit
6c1bde6a94
@ -133,10 +133,7 @@ int
|
|||||||
virNWFilterRuleInstAddData(virNWFilterRuleInstPtr res,
|
virNWFilterRuleInstAddData(virNWFilterRuleInstPtr res,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
if (VIR_REALLOC_N(res->data, res->ndata+1) < 0)
|
return VIR_APPEND_ELEMENT(res->data, res->ndata, data);
|
||||||
return -1;
|
|
||||||
res->data[res->ndata++] = data;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -404,7 +401,7 @@ _virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
|
|||||||
virNWFilterDefPtr filter,
|
virNWFilterDefPtr filter,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
virNWFilterHashTablePtr vars,
|
virNWFilterHashTablePtr vars,
|
||||||
int *nEntries,
|
size_t *nEntries,
|
||||||
virNWFilterRuleInstPtr **insts,
|
virNWFilterRuleInstPtr **insts,
|
||||||
enum instCase useNewFilter, bool *foundNewFilter,
|
enum instCase useNewFilter, bool *foundNewFilter,
|
||||||
virNWFilterDriverStatePtr driver)
|
virNWFilterDriverStatePtr driver)
|
||||||
@ -430,13 +427,11 @@ _virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_REALLOC_N(*insts, (*nEntries)+1) < 0) {
|
if (VIR_APPEND_ELEMENT_COPY(*insts, *nEntries, inst) < 0) {
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*insts)[(*nEntries)++] = inst;
|
|
||||||
|
|
||||||
} else if (inc) {
|
} else if (inc) {
|
||||||
VIR_DEBUG("Instantiating filter %s", inc->filterref);
|
VIR_DEBUG("Instantiating filter %s", inc->filterref);
|
||||||
obj = virNWFilterObjFindByName(&driver->nwfilters, inc->filterref);
|
obj = virNWFilterObjFindByName(&driver->nwfilters, inc->filterref);
|
||||||
@ -675,7 +670,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
|||||||
int rc;
|
int rc;
|
||||||
size_t j;
|
size_t j;
|
||||||
int nptrs;
|
int nptrs;
|
||||||
int nEntries = 0;
|
size_t nEntries = 0;
|
||||||
virNWFilterRuleInstPtr *insts = NULL;
|
virNWFilterRuleInstPtr *insts = NULL;
|
||||||
void **ptrs = NULL;
|
void **ptrs = NULL;
|
||||||
bool instantiate = true;
|
bool instantiate = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user