if (ipNodes == NULL)
return 0;
- if (VIR_ALLOC_N(def->ips, nipNodes) < 0)
- goto error;
+ def->ips = g_new0(virInterfaceIPDefPtr, nipNodes);
def->nips = 0;
for (i = 0; i < nipNodes; i++) {
virInterfaceIPDefPtr ip;
- if (VIR_ALLOC(ip) < 0)
- goto error;
+ ip = g_new0(virInterfaceIPDef, 1);
ctxt->node = ipNodes[i];
if (virInterfaceDefParseIP(ip, ctxt) < 0) {
if (ipNodes == NULL)
return 0;
- if (VIR_ALLOC_N(def->ips, nipNodes) < 0)
- goto error;
+ def->ips = g_new0(virInterfaceIPDefPtr, nipNodes);
def->nips = 0;
for (i = 0; i < nipNodes; i++) {
virInterfaceIPDefPtr ip;
- if (VIR_ALLOC(ip) < 0)
- goto error;
+ ip = g_new0(virInterfaceIPDef, 1);
ctxt->node = ipNodes[i];
if (virInterfaceDefParseIP(ip, ctxt) < 0) {
return 0;
}
- if (VIR_ALLOC_N(def->protos, nProtoNodes) < 0)
- goto error;
+ def->protos = g_new0(virInterfaceProtocolDefPtr, nProtoNodes);
def->nprotos = 0;
for (pp = 0; pp < nProtoNodes; pp++) {
virInterfaceProtocolDefPtr proto;
- if (VIR_ALLOC(proto) < 0)
- goto error;
+ proto = g_new0(virInterfaceProtocolDef, 1);
ctxt->node = protoNodes[pp];
tmp = virXPathString("string(./@family)", ctxt);
goto error;
}
if (nbItf > 0) {
- if (VIR_ALLOC_N(def->data.bridge.itf, nbItf) < 0) {
- ret = -1;
- goto error;
- }
+ def->data.bridge.itf = g_new0(struct _virInterfaceDef *, nbItf);
def->data.bridge.nbItf = nbItf;
for (i = 0; i < nbItf; i++) {
goto cleanup;
}
- if (VIR_ALLOC_N(def->data.bond.itf, nbItf) < 0)
- goto cleanup;
+ def->data.bond.itf = g_new0(struct _virInterfaceDef *, nbItf);
def->data.bond.nbItf = nbItf;
}
VIR_FREE(tmp);
- if (VIR_ALLOC(def) < 0)
- return NULL;
+ def = g_new0(virInterfaceDef, 1);
if (((parentIfType == VIR_INTERFACE_TYPE_BOND)
&& (type != VIR_INTERFACE_TYPE_ETHERNET))