virDomainNetDefNew(virDomainXMLOptionPtr xmlopt)
{
    virDomainNetDefPtr def = NULL;

    if (VIR_ALLOC(def) < 0)
        return NULL;

    if (xmlopt && xmlopt->privateData.networkNew &&
        !(def->privateData = xmlopt->privateData.networkNew())) {
        virDomainNetDefFree(def);
        def = NULL;
    }

    return def;
}
virDomainNetDefNew(virDomainXMLOptionPtr xmlopt)
{
    virDomainNetDefPtr def = NULL;

    if (VIR_ALLOC(def) < 0)
        return NULL;

    if (xmlopt && xmlopt->privateData.networkNew &&
        !(def->privateData = xmlopt->privateData.networkNew())) {
        virDomainNetDefFree(def);
        def = NULL;
    }

    return def;
}