{
vmwareDomainPtr dom;
- if (VIR_ALLOC(dom) < 0)
- return NULL;
+ dom = g_new0(vmwareDomain, 1);
dom->vmxPath = NULL;
dom->gui = true;
/* We now know the URI is definitely for this driver, so beyond
* here, don't return DECLINED, always use ERROR */
- if (VIR_ALLOC(driver) < 0)
- return VIR_DRV_OPEN_ERROR;
+ driver = g_new0(struct vmware_driver, 1);
/* Find vmrun, which is what this driver uses to communicate to
* the VMware hypervisor. We look this up first since we use it
++length;
}
- if (VIR_ALLOC_N(escaped, length) < 0)
- return NULL;
+ escaped = g_new0(char, length);
tmp1 = string; /* reading from this one */
tmp2 = escaped; /* writing to this one */
int count = 0;
int *autodetectedModels;
- if (VIR_ALLOC_N(autodetectedModels, def->ndisks) < 0)
- return -1;
+ autodetectedModels = g_new0(int, def->ndisks);
for (i = 0; i < def->ncontrollers; ++i) {
controller = def->controllers[i];
/* FIXME */
/* def:graphics */
- if (VIR_ALLOC_N(def->graphics, 1) < 0)
- goto cleanup;
-
+ def->graphics = g_new0(virDomainGraphicsDefPtr, 1);
def->ngraphics = 0;
if (virVMXParseVNC(conf, &def->graphics[def->ngraphics]) < 0)
++def->ngraphics;
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
- if (VIR_ALLOC_N(def->disks, 66) < 0)
- goto cleanup;
-
+ def->disks = g_new0(virDomainDiskDefPtr, 66);
def->ndisks = 0;
/* def:disks (scsi) */
if (sharedFolder_maxNum > 0) {
int number;
- if (VIR_ALLOC_N(def->fss, sharedFolder_maxNum) < 0)
- goto cleanup;
-
+ def->fss = g_new0(virDomainFSDefPtr, sharedFolder_maxNum);
def->nfss = 0;
for (number = 0; number < sharedFolder_maxNum; ++number) {
/* FIXME */
/* def:videos */
- if (VIR_ALLOC_N(def->videos, 1) < 0)
- goto cleanup;
-
+ def->videos = g_new0(virDomainVideoDefPtr, 1);
def->nvideos = 0;
if (virVMXParseSVGA(conf, &def->videos[def->nvideos]) < 0)
/* FIXME */
/* def:serials */
- if (VIR_ALLOC_N(def->serials, 4) < 0)
- goto cleanup;
-
+ def->serials = g_new0(virDomainChrDefPtr, 4);
def->nserials = 0;
for (port = 0; port < 4; ++port) {
}
/* def:parallels */
- if (VIR_ALLOC_N(def->parallels, 3) < 0)
- goto cleanup;
-
+ def->parallels = g_new0(virDomainChrDefPtr, 3);
def->nparallels = 0;
for (port = 0; port < 3; ++port) {
if (ctx->datacenterPath || ctx->moref) {
struct virVMXDomainDefNamespaceData *nsdata = NULL;
- if (VIR_ALLOC(nsdata) < 0) {
- virVMXDomainDefNamespaceFree(nsdata);
- goto cleanup;
- }
+ nsdata = g_new0(struct virVMXDomainDefNamespaceData, 1);
nsdata->datacenterPath = g_strdup(ctx->datacenterPath);
if (! enabled)
return 0;
- if (VIR_ALLOC(*def) < 0)
- goto failure;
-
+ *def = g_new0(virDomainGraphicsDef, 1);
(*def)->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
if (virVMXGetConfigLong(conf, "RemoteDisplay.vnc.port", &port, -1,
if (! present/* && ! startConnected*/)
return 0;
- if (VIR_ALLOC(*def) < 0)
- return -1;
+ *def = g_new0(virDomainNetDef, 1);
/* vmx:connectionType -> def:type */
if (virVMXGetConfigString(conf, connectionType_name, &connectionType,
return -1;
}
- if (VIR_ALLOC(*def) < 0)
- return -1;
-
+ *def = g_new0(virDomainVideoDef, 1);
(*def)->type = VIR_DOMAIN_VIDEO_TYPE_VMVGA;
/* vmx:vramSize */