if (virSysinfoFormat(&buf, privconn->hostsysinfo) < 0)
return NULL;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAddChar(&buf, '\n');
virBufferAdd(&buf, virCommandToString(cmd), -1);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
ret = virBufferContentAndReset(&buf);
if (virCPUDefFormatBufFull(&buf, def, flags) < 0)
goto cleanup;
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto cleanup;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
cleanup:
virBufferFreeAndReset(&buf);
return NULL;
}
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
- virBufferFreeAndReset(&buffer);
+ if (virBufferCheckError(&buffer) < 0)
goto error;
- }
string = virBufferContentAndReset(&buffer);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</domain>\n");
- if (virBufferError(buf))
- goto no_memory;
+ if (virBufferCheckError(buf) < 0)
+ goto error;
return 0;
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(buf);
return -1;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</domstatus>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</interface>\n");
- if (virBufferError(buf))
- goto no_memory;
+ if (virBufferCheckError(buf) < 0)
+ goto cleanup;
+
return 0;
- no_memory:
- virReportOOMError();
+
cleanup:
return -1;
}
if (virNetworkDefFormatBuf(&buf, def, flags) < 0)
goto error;
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</networkstatus>");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</device>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ return NULL;
return virBufferContentAndReset(&buf);
-
- no_memory:
- virReportOOMError();
- virBufferFreeAndReset(&buf);
- return NULL;
}
/**
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
printTCPFlags(&buf, flags);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
printed = true;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
- virBufferFreeAndReset(&buf);
+ if (virBufferCheckError(&buf) < 0)
goto err_exit;
- }
msg = virBufferContentAndReset(&buf);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</filter>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto err_exit;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
-
err_exit:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</secret>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</domainsnapshot>\n");
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</pool>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto cleanup;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
cleanup:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</volume>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto cleanup;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
cleanup:
virBufferFreeAndReset(&buf);
return NULL;
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</sources>\n");
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto cleanup;
return virBufferContentAndReset(&buf);
- no_memory:
- virReportOOMError();
cleanup:
virBufferFreeAndReset(&buf);
return NULL;
goto cleanup;
}
- if ((ctxt = xmlXPathNewContext(xml)) == NULL)
- goto no_memory;
+ if ((ctxt = xmlXPathNewContext(xml)) == NULL) {
+ virReportOOMError();
+ goto cleanup;
+ }
virBufferAsprintf(&buf, "./arch[@name='%s']", arch);
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto cleanup;
xpath = virBufferContentAndReset(&buf);
VIR_FREE(mapfile);
return ret;
-
- no_memory:
- virReportOOMError();
- goto cleanup;
}
}
virBufferAddLit(&buf, "</cpudata>\n");
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAddChar(&buffer, separator);
virBufferAdd(&buffer, directoryAndFileName, -1);
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
result = virBufferContentAndReset(&buffer);
} else if (*fileName == '/') {
virBufferAddLit(&buffer, "&dsName=");
virBufferURIEncodeString(&buffer, datastoreName);
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
url = virBufferContentAndReset(&buffer);
virBufferAddLit(&buffer, "&dsName=");
virBufferURIEncodeString(&buffer, datastoreName);
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
url = virBufferContentAndReset(&buffer);
}
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
- virBufferFreeAndReset(&buffer);
-
+ if (virBufferCheckError(&buffer) < 0)
return NULL;
- }
return virBufferContentAndReset(&buffer);
}
virBufferEscapeString(&buffer, "%s", string);
- if (virBufferError(&buffer)) {
- virReportOOMError();
- virBufferFreeAndReset(&buffer);
-
+ if (virBufferCheckError(&buffer) < 0)
return NULL;
- }
return virBufferContentAndReset(&buffer);
}
goto cleanup;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
if (length) {
*length = virBufferUse(&buffer);
goto cleanup;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
ctx->datacenterPath = virBufferContentAndReset(&buffer);
goto cleanup;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
ctx->computeResourcePath = virBufferContentAndReset(&buffer);
goto cleanup;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
(*response)->content = virBufferContentAndReset(&buffer);
++answerIndex;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
possibleAnswers = virBufferContentAndReset(&buffer);
}
virBufferAddLit(&buffer, "</"#_name">"); \
virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER); \
\
- if (virBufferError(&buffer)) { \
- virReportOOMError(); \
+ if (virBufferCheckError(&buffer) < 0) \
goto cleanup; \
- } \
\
request = virBufferContentAndReset(&buffer); \
\
return -1;
}
- if (virBufferError(query)) {
- virReportOOMError();
+ if (virBufferCheckError(query) < 0)
return -1;
- }
serializerContext = wsmc_get_serialization_context(priv->client);
if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
return NULL;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferEscape(&buf, '\\', "\\ ", "%s",
virDomainLockFailureTypeToString(action));
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
/* Unfortunately, sanlock_killpath() does not use const for either
* path or args even though it will just copy them into its own
virBufferAsprintf(&map_value, "%u %u %u\n",
map[i].start, map[i].target, map[i].count);
- if (virBufferError(&map_value))
- goto no_memory;
+ if (virBufferCheckError(&map_value) < 0)
+ goto cleanup;
VIR_DEBUG("Set '%s' to '%s'", path, virBufferCurrentContent(&map_value));
cleanup:
virBufferFreeAndReset(&map_value);
return ret;
-
- no_memory:
- virReportOOMError();
- goto cleanup;
}
/**
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].weight);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].riops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].wiops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].rbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].wbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].weight);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].riops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].wiops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].rbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].wbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
return NULL;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</hookData>");
- if (virBufferError(&buf) ||
- !(xml = virBufferContentAndReset(&buf)))
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
+ xml = virBufferContentAndReset(&buf);
hookret = virHookCall(VIR_HOOK_DRIVER_NETWORK, network->def->name,
op, sub_op, NULL, xml, NULL);
virBufferAddLit(&configbuf, "};\n");
- if (virBufferError(&configbuf)) {
- virReportOOMError();
+ if (virBufferCheckError(&configbuf) < 0)
goto cleanup;
- }
*configstr = virBufferContentAndReset(&configbuf);
virBufferAsprintf(&buf, "_%s", s);
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- VIR_ERROR(_("Buffer error when generating device name for device "
- "with sysname '%s'"), udev_device_get_sysname(device));
- ret = -1;
- }
+ if (virBufferCheckError(&buf) < 0)
+ return -1;
def->name = virBufferContentAndReset(&buf);
}
}
- if (virBufferError(&vb)) {
- virReportOOMError();
- virBufferFreeAndReset(&vb);
+ if (virBufferCheckError(&vb) < 0)
return -1;
- }
flags = virBufferContentAndReset(&vb);
"",
flags,
false);
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return -1;
- }
*bufptr = virBufferContentAndReset(&buf);
return 0;
}
virHashForEach(vars, printString, &ps);
- if (virBufferError(&ps.buf)) {
- virBufferFreeAndReset(&ps.buf);
- virReportOOMError();
+ if (virBufferCheckError(&ps.buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&ps.buf);
}
channel = NULL;
VIR_FREE(buffer);
- if (virBufferError(&tex_ret)) {
- virBufferFreeAndReset(&tex_ret);
- virReportOOMError();
+ if (virBufferCheckError(&tex_ret) < 0)
return NULL;
- }
return virBufferContentAndReset(&tex_ret);
err:
char *cmd;
char *ret;
- if (virBufferError(buf)) {
- virBufferFreeAndReset(buf);
- virReportOOMError();
+ if (virBufferCheckError(buf) < 0)
return NULL;
- }
cmd = virBufferContentAndReset(buf);
ret = phypExec(session, cmd, exit_status, conn);
VIR_FREE(cmd);
if (src)
virBufferAsprintf(&buf, ":exportname=%s", src);
- if (virBufferError(&buf) < 0) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
ret = virBufferContentAndReset(&buf);
goto cleanup;
}
}
- if (virBufferError(&buf) < 0) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
ret = virBufferContentAndReset(&buf);
break;
disk->blkdeviotune.write_iops_sec);
}
- if (virBufferError(&opt)) {
- virReportOOMError();
+ if (virBufferCheckError(&opt) < 0)
goto error;
- }
return virBufferContentAndReset(&opt);
}
}
- if (virBufferError(&opt)) {
- virReportOOMError();
+ if (virBufferCheckError(&opt) < 0)
goto error;
- }
return virBufferContentAndReset(&opt);
}
}
- if (virBufferError(&opt)) {
- virReportOOMError();
+ if (virBufferCheckError(&opt) < 0)
goto error;
- }
return virBufferContentAndReset(&opt);
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&opt)) {
- virReportOOMError();
+ if (virBufferCheckError(&opt) < 0)
goto error;
- }
return virBufferContentAndReset(&opt);
if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (bootindex && virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
virBufferAsprintf(&buf, ",bootindex=%d", bootindex);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
virObjectUnref(cfg);
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
goto error;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &sound->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0)
goto error;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
}
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
VIR_FREE(sg);
return virBufferContentAndReset(&buf);
if (dev->info->bootIndex)
virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
error:
goto error;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
break;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
} else {
virBufferAsprintf(&buf, ",id=%s", dev->info.alias);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
}
virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
dev->info.alias, dev->info.alias);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
goto error;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s",
model, tpm->info.alias, tpm->info.alias);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (def->bios_release)
virBufferAsprintf(&buf, ",release=%s", def->bios_release);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
if (def->system_family)
virBufferAsprintf(&buf, ",family=%s", def->system_family);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
}
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
return virBufferContentAndReset(&buf);
}
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
*opt = virBufferContentAndReset(&buf);
return NULL;
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
1024) * 1024;
virBufferAsprintf(&buf, ",mem=%d", def->cpu->cells[i].mem / 1024);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
virCommandAddArgBuffer(cmd, &buf);
}
if (boot_nparams > 0) {
virCommandAddArg(cmd, "-boot");
- if (virBufferError(&boot_buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&boot_buf) < 0)
goto error;
- }
if (boot_nparams < 2 || emitBootindex) {
virCommandAddArgBuffer(cmd, &boot_buf);
}
}
- if (virBufferError(&cmd)) {
- virReportOOMError();
+ if (virBufferCheckError(&cmd) < 0)
goto error;
- }
*deviceStr = virBufferContentAndReset(&cmd);
return 0;
if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0)
return NULL;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].weight);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].riops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].wiops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].rbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
vm->def->blkio.devices[j].path,
vm->def->blkio.devices[j].wbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (virTypedParameterAssign(param,
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].weight);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].riops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].wiops);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].rbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
persistentDef->blkio.devices[j].path,
persistentDef->blkio.devices[j].wbps);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
param->value.s = virBufferContentAndReset(&buf);
}
if (!param->value.s && VIR_STRDUP(param->value.s, "") < 0)
return NULL;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
- virBufferFreeAndReset(&buf);
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
/* Migrate to file */
virBufferEscapeShell(&buf, target);
- if (virBufferError(&buf)) {
- virReportOOMError();
- virBufferFreeAndReset(&buf);
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
safe_target = virBufferContentAndReset(&buf);
/* Two dd processes, sharing the same stdout, are necessary to
virBufferAddLit(&extra, " -b");
if (flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC)
virBufferAddLit(&extra, " -i");
- if (virBufferError(&extra)) {
- virBufferFreeAndReset(&extra);
- virReportOOMError();
+ if (virBufferCheckError(&extra) < 0)
goto cleanup;
- }
extrastr = virBufferContentAndReset(&extra);
if (virAsprintf(&cmd, "migrate %s\"%s\"", extrastr ? extrastr : "",
if (holdtime)
virBufferAsprintf(&buf, " %u", holdtime);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return -1;
- }
cmd = virBufferContentAndReset(&buf);
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
virCommandAddArgList(cmd, nodename, "sh", "-c", NULL);
virBufferEscapeShell(&buf, netcat);
- if (virBufferError(&buf)) {
+ if (virBufferCheckError(&buf) < 0) {
virCommandFree(cmd);
- virBufferFreeAndReset(&buf);
- virReportOOMError();
return -1;
}
quoted = virBufferContentAndReset(&buf);
virBufferAsprintf(&buff, "%02hhX:", keyhash[i]);
virBufferTrim(&buff, ":", 1);
- if (virBufferError(&buff) != 0) {
- virReportOOMError();
+ if (virBufferCheckError(&buff) < 0)
return -1;
- }
keyhashstr = virBufferContentAndReset(&buff);
* to port number */
virBufferAsprintf(&buff, "[%s]:%d", sess->hostname, sess->port);
- if (virBufferError(&buff) != 0) {
- virReportOOMError();
+ if (virBufferCheckError(&buff) < 0)
return -1;
- }
hostnameStr = virBufferContentAndReset(&buff);
virBufferTrim(&buf, ",", -1);
- if (virBufferError(&buf))
- goto no_memory;
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
*opts = virBufferContentAndReset(&buf);
return 0;
- no_memory:
- virReportOOMError();
error:
virBufferFreeAndReset(&buf);
return -1;
}
}
- if (virBufferError(&mon_host)) {
- virReportOOMError();
- goto cleanup;
- }
+ if (virBufferCheckError(&mon_host) < 0)
+ goto cleanup;
mon_buff = virBufferContentAndReset(&mon_host);
VIR_DEBUG("RADOS mon_host has been set to: %s", mon_buff);
def->data.socket.port);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
virBufferEscapeShell(&buf, cmd->args[i]);
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
cur = cur->next;
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return -1;
- }
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd < 0) {
cur = cur->next;
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return -1;
- }
use = virBufferUse(&buf);
content = virBufferContentAndReset(&buf);
virBufferAsprintf(&buf, "%d", virtVlan->tag[i]);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
virCommandAddArg(cmd, virBufferCurrentContent(&buf));
} else if (virtVlan->nTags) {
virCommandAddArgFormat(cmd, "tag=%d", virtVlan->tag[0]);
virBufferAdd(&buf, components[i], -1);
}
- if (virBufferError(&buf) != 0) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
/* if the output string is empty just return an empty string */
if (!(ret = virBufferContentAndReset(&buf)))
virBufferAdd(&buf, delim, -1);
strings++;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
ret = virBufferContentAndReset(&buf);
if (!ret)
ignore_value(VIR_STRDUP(ret, ""));
tmp1 = tmp2;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</sysinfo>\n");
- if (virBufferError(buf)) {
- virReportOOMError();
+ if (virBufferCheckError(buf) < 0)
return -1;
- }
return 0;
}
virSystemdEscapeName(&buf, name);
virBufferAddLit(&buf, ".scope");
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virSystemdEscapeName(&buf, partition);
virBufferAddLit(&buf, ".slice");
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
}
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
}
/* Get final VMX output */
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto cleanup;
- }
vmx = virBufferContentAndReset(&buffer);
if (virSysinfoFormat(&buf, hostsysinfo) < 0)
return NULL;
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
return virBufferContentAndReset(&buf);
}
virBufferAddChar(&buf, '&');
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
return -1;
- }
content = virBufferContentAndReset(&buf);
VIR_DEBUG("xend op: %s\n", content);
goto error;
}
- if (virBufferError(&buffer)) {
- virReportOOMError();
+ if (virBufferCheckError(&buffer) < 0)
goto error;
- }
content = virBufferContentAndReset(&buffer);
}
}
}
- if (virBufferError(&buf)) {
- virReportOOMError();
- virBufferFreeAndReset(&buf);
+ if (virBufferCheckError(&buf) < 0)
return NULL;
- }
ret = virBufferContentAndReset(&buf);
len = strlen(ret);
if (len > 0 && ret[len - 1] == ',')
return -1;
}
- if (virBufferError(buf)) {
- virReportOOMError();
+ if (virBufferCheckError(buf) < 0)
return -1;
- }
return 0;
}
virBufferEscapeSexpr(buf, "%s", str);
}
- if (virBufferError(buf)) {
- virReportOOMError();
+ if (virBufferCheckError(buf) < 0)
return -1;
- }
return 0;
}
virBufferAddLit(&buf, ")"); /* closes (vm */
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto error;
- }
bufout = virBufferContentAndReset(&buf);
VIR_DEBUG("Formatted sexpr: \n%s", bufout);
return -1;
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
if (VIR_ALLOC(val) < 0)
goto cleanup;
} else {
virBufferAddLit(&buf, "none");
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
if (VIR_ALLOC(val) < 0)
goto cleanup;
virBufferAsprintf(&buf, ",vifname=%s",
net->ifname);
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
if (VIR_ALLOC(val) < 0)
goto cleanup;
virBufferAsprintf(&buf, ",keymap=%s",
def->graphics[0]->data.vnc.keymap);
}
- if (virBufferError(&buf)) {
- virBufferFreeAndReset(&buf);
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
vfbstr = virBufferContentAndReset(&buf);
virBufferStrcat(&buf, *xmlLine, "\n", NULL);
}
- if (virBufferError(&buf)) {
- virReportOOMError();
+ if (virBufferCheckError(&buf) < 0)
goto cleanup;
- }
ret = virBufferContentAndReset(&buf);