mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: use g_auto() for all virBuffers
Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
28f7ddae05
commit
b8b58e22b9
@ -155,7 +155,7 @@ static char *
|
||||
qemuAgentEscapeNonPrintable(const char *text)
|
||||
{
|
||||
size_t i;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
for (i = 0; text[i] != '\0'; i++) {
|
||||
if (text[i] == '\\')
|
||||
virBufferAddLit(&buf, "\\\\");
|
||||
|
@ -3283,7 +3283,7 @@ qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src)
|
||||
char *
|
||||
qemuBlockStorageSourceGetCookieString(virStorageSourcePtr src)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < src->ncookies; i++) {
|
||||
|
@ -4604,7 +4604,7 @@ virQEMUCapsFormatSEVInfo(virQEMUCapsPtr qemuCaps, virBufferPtr buf)
|
||||
char *
|
||||
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
size_t i;
|
||||
|
||||
virBufferAddLit(&buf, "<qemuCaps>\n");
|
||||
|
@ -5478,7 +5478,7 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager,
|
||||
|
||||
for (i = 0; i < def->nrngs; i++) {
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
virDomainRNGDefPtr rng = def->rngs[i];
|
||||
g_autofree char *chardev = NULL;
|
||||
g_autofree char *devstr = NULL;
|
||||
@ -6156,7 +6156,7 @@ qemuBuildBootCommandLine(virCommandPtr cmd,
|
||||
if (def->os.dtb)
|
||||
virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
|
||||
if (def->os.slic_table) {
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
virCommandAddArg(cmd, "-acpitable");
|
||||
virBufferAddLit(&buf, "sig=SLIC,file=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->os.slic_table);
|
||||
|
@ -100,7 +100,7 @@ qemuDBusGetAddress(virQEMUDriverPtr driver,
|
||||
static int
|
||||
qemuDBusWriteConfig(const char *filename, const char *path)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
g_autofree char *config = NULL;
|
||||
|
||||
virBufferAddLit(&buf, "<!DOCTYPE busconfig PUBLIC \"-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN\"\n");
|
||||
|
@ -4838,7 +4838,7 @@ qemuDomainChrDefDropDefaultPath(virDomainChrDefPtr chr,
|
||||
virQEMUDriverPtr driver)
|
||||
{
|
||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
g_autofree char *regexp = NULL;
|
||||
|
||||
if (chr->deviceType != VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL ||
|
||||
@ -6019,7 +6019,7 @@ qemuDomainDefFormatXMLInternal(virQEMUDriverPtr driver,
|
||||
virCPUDefPtr origCPU,
|
||||
unsigned int flags)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (qemuDomainDefFormatBufInternal(driver, qemuCaps, def, origCPU, flags, &buf) < 0)
|
||||
return NULL;
|
||||
|
@ -1272,7 +1272,7 @@ static char *
|
||||
qemuConnectGetSysinfo(virConnectPtr conn, unsigned int flags)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
@ -14392,7 +14392,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
|
||||
virBitmapPtr created = NULL;
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
int ret = -1;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
virDomainSnapshotDefPtr snapdef = virDomainSnapshotObjGetDef(snap);
|
||||
|
||||
if (!(qemuImgPath = qemuFindQemuImgBinary(driver)))
|
||||
@ -14479,7 +14479,6 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virBufferFreeAndReset(&buf);
|
||||
virCommandFree(cmd);
|
||||
|
||||
/* unlink images if creation has failed */
|
||||
|
@ -178,7 +178,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr conn,
|
||||
virStorageVolPtr vol = NULL;
|
||||
char *volName = NULL, *basePath = NULL;
|
||||
char *volStr = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
const char *format = NULL;
|
||||
unsigned int flags = 0;
|
||||
|
||||
|
@ -869,12 +869,10 @@ qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
qemuMigrationCookiePtr mig)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ static char *
|
||||
qemuMonitorEscapeNonPrintable(const char *text)
|
||||
{
|
||||
size_t i;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
for (i = 0; text[i] != '\0'; i++) {
|
||||
if (g_ascii_isprint(text[i]) ||
|
||||
text[i] == '\n' ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user