memcpy(&port->mac, &iface->mac, VIR_MAC_BUFLEN);
- if (virNetDevVPortProfileCopy(&port->virtPortProfile, iface->virtPortProfile) < 0)
- return NULL;
+ port->virtPortProfile = virNetDevVPortProfileCopy(iface->virtPortProfile);
if (virNetDevBandwidthCopy(&port->bandwidth, iface->bandwidth) < 0)
return NULL;
goto error;
}
- if (virNetDevVPortProfileCopy(&actual->virtPortProfile, port->virtPortProfile) < 0)
- goto error;
+ actual->virtPortProfile = virNetDevVPortProfileCopy(port->virtPortProfile);
if (virNetDevBandwidthCopy(&actual->bandwidth, port->bandwidth) < 0)
goto error;
return NULL;
}
- if (virNetDevVPortProfileCopy(&port->virtPortProfile, actual->virtPortProfile) < 0)
- return NULL;
+ port->virtPortProfile = virNetDevVPortProfileCopy(actual->virtPortProfile);
if (virNetDevBandwidthCopy(&port->bandwidth, actual->bandwidth) < 0)
return NULL;
}
-int virNetDevVPortProfileCopy(virNetDevVPortProfile **dst, const virNetDevVPortProfile *src)
+virNetDevVPortProfile *
+virNetDevVPortProfileCopy(const virNetDevVPortProfile *src)
{
- if (!src) {
- *dst = NULL;
- return 0;
- }
+ virNetDevVPortProfile *ret = NULL;
- *dst = g_new0(virNetDevVPortProfile, 1);
- memcpy(*dst, src, sizeof(*src));
- return 0;
+ if (!src)
+ return NULL;
+
+ ret = g_new0(virNetDevVPortProfile, 1);
+ memcpy(ret, src, sizeof(*ret));
+
+ return ret;
}
bool virNetDevVPortProfileEqual(const virNetDevVPortProfile *a,
const virNetDevVPortProfile *b);
-int virNetDevVPortProfileCopy(virNetDevVPortProfile **dst,
- const virNetDevVPortProfile *src);
+
+virNetDevVPortProfile *
+virNetDevVPortProfileCopy(const virNetDevVPortProfile *src);
int virNetDevVPortProfileCheckComplete(virNetDevVPortProfile *virtport,
bool generateMissing);