mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
conf: 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
ecc4ee2c42
commit
0e3dc7c5c5
@ -705,7 +705,7 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
|
|||||||
|
|
||||||
/* XXX check default_emulator, see how it uses this */
|
/* XXX check default_emulator, see how it uses this */
|
||||||
if (!foundguest) {
|
if (!foundguest) {
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
if (ostype)
|
if (ostype)
|
||||||
virBufferAsprintf(&buf, "ostype=%s ",
|
virBufferAsprintf(&buf, "ostype=%s ",
|
||||||
virDomainOSTypeToString(ostype));
|
virDomainOSTypeToString(ostype));
|
||||||
@ -725,7 +725,6 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
|
|||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("could not find capabilities for %s"),
|
_("could not find capabilities for %s"),
|
||||||
virBufferCurrentContent(&buf));
|
virBufferCurrentContent(&buf));
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,7 +900,7 @@ virCapabilitiesFormatResctrlMonitor(virBufferPtr buf,
|
|||||||
virResctrlInfoMonPtr monitor)
|
virResctrlInfoMonPtr monitor)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
virBuffer childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
|
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
|
||||||
/* monitor not supported, no capability */
|
/* monitor not supported, no capability */
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
@ -1335,7 +1334,7 @@ virCapabilitiesFormatStoragePoolXML(virCapsStoragePoolPtr *pools,
|
|||||||
char *
|
char *
|
||||||
virCapabilitiesFormatXML(virCapsPtr caps)
|
virCapabilitiesFormatXML(virCapsPtr caps)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<capabilities>\n\n");
|
virBufferAddLit(&buf, "<capabilities>\n\n");
|
||||||
virBufferAdjustIndent(&buf, 2);
|
virBufferAdjustIndent(&buf, 2);
|
||||||
@ -1353,7 +1352,6 @@ virCapabilitiesFormatXML(virCapsPtr caps)
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
|
|||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_CHECKPOINT_FORMAT_SECURE |
|
virCheckFlags(VIR_DOMAIN_CHECKPOINT_FORMAT_SECURE |
|
||||||
VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN |
|
VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN |
|
||||||
|
@ -668,7 +668,7 @@ char *
|
|||||||
virCPUDefFormat(virCPUDefPtr def,
|
virCPUDefFormat(virCPUDefPtr def,
|
||||||
virDomainNumaPtr numa)
|
virDomainNumaPtr numa)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virCPUDefFormatBufFull(&buf, def, numa) < 0)
|
if (virCPUDefFormatBufFull(&buf, def, numa) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -676,7 +676,6 @@ virCPUDefFormat(virCPUDefPtr def,
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,8 +686,8 @@ virCPUDefFormatBufFull(virBufferPtr buf,
|
|||||||
virDomainNumaPtr numa)
|
virDomainNumaPtr numa)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virBuffer attributeBuf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) attributeBuf = VIR_BUFFER_INITIALIZER;
|
||||||
virBuffer childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
|
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
|
||||||
if (!def)
|
if (!def)
|
||||||
return 0;
|
return 0;
|
||||||
@ -755,8 +754,6 @@ virCPUDefFormatBufFull(virBufferPtr buf,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virBufferFreeAndReset(&attributeBuf);
|
|
||||||
virBufferFreeAndReset(&childrenBuf);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,7 +1941,7 @@ virDomainUSBAddressPortFormatBuf(virBufferPtr buf,
|
|||||||
static char * ATTRIBUTE_NONNULL(1)
|
static char * ATTRIBUTE_NONNULL(1)
|
||||||
virDomainUSBAddressPortFormat(unsigned int *port)
|
virDomainUSBAddressPortFormat(unsigned int *port)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
virDomainUSBAddressPortFormatBuf(&buf, port);
|
virDomainUSBAddressPortFormatBuf(&buf, port);
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ virDomainCapsFormatFeatures(const virDomainCaps *caps,
|
|||||||
char *
|
char *
|
||||||
virDomainCapsFormat(const virDomainCaps *caps)
|
virDomainCapsFormat(const virDomainCaps *caps)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *virttype_str = virDomainVirtTypeToString(caps->virttype);
|
const char *virttype_str = virDomainVirtTypeToString(caps->virttype);
|
||||||
const char *arch_str = virArchToString(caps->arch);
|
const char *arch_str = virArchToString(caps->arch);
|
||||||
|
|
||||||
|
@ -25264,7 +25264,7 @@ static int
|
|||||||
virDomainDiskDefFormatIotune(virBufferPtr buf,
|
virDomainDiskDefFormatIotune(virBufferPtr buf,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
virBuffer childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
|
|
||||||
FORMAT_IOTUNE(total_bytes_sec);
|
FORMAT_IOTUNE(total_bytes_sec);
|
||||||
FORMAT_IOTUNE(read_bytes_sec);
|
FORMAT_IOTUNE(read_bytes_sec);
|
||||||
@ -25309,7 +25309,7 @@ static int
|
|||||||
virDomainDiskDefFormatDriver(virBufferPtr buf,
|
virDomainDiskDefFormatDriver(virBufferPtr buf,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virBufferEscapeString(&driverBuf, " name='%s'", virDomainDiskGetDriver(disk));
|
virBufferEscapeString(&driverBuf, " name='%s'", virDomainDiskGetDriver(disk));
|
||||||
|
|
||||||
@ -26293,7 +26293,7 @@ static int
|
|||||||
virDomainVirtioNetGuestOptsFormat(char **outstr,
|
virDomainVirtioNetGuestOptsFormat(char **outstr,
|
||||||
virDomainNetDefPtr def)
|
virDomainNetDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
if (def->driver.virtio.guest.csum) {
|
if (def->driver.virtio.guest.csum) {
|
||||||
virBufferAsprintf(&buf, "csum='%s' ",
|
virBufferAsprintf(&buf, "csum='%s' ",
|
||||||
virTristateSwitchTypeToString(def->driver.virtio.guest.csum));
|
virTristateSwitchTypeToString(def->driver.virtio.guest.csum));
|
||||||
@ -26325,7 +26325,7 @@ static int
|
|||||||
virDomainVirtioNetHostOptsFormat(char **outstr,
|
virDomainVirtioNetHostOptsFormat(char **outstr,
|
||||||
virDomainNetDefPtr def)
|
virDomainNetDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
if (def->driver.virtio.host.csum) {
|
if (def->driver.virtio.host.csum) {
|
||||||
virBufferAsprintf(&buf, "csum='%s' ",
|
virBufferAsprintf(&buf, "csum='%s' ",
|
||||||
virTristateSwitchTypeToString(def->driver.virtio.host.csum));
|
virTristateSwitchTypeToString(def->driver.virtio.host.csum));
|
||||||
@ -26365,7 +26365,7 @@ static int
|
|||||||
virDomainVirtioNetDriverFormat(char **outstr,
|
virDomainVirtioNetDriverFormat(char **outstr,
|
||||||
virDomainNetDefPtr def)
|
virDomainNetDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
if (def->driver.virtio.name) {
|
if (def->driver.virtio.name) {
|
||||||
virBufferAsprintf(&buf, " name='%s'",
|
virBufferAsprintf(&buf, " name='%s'",
|
||||||
virDomainNetBackendTypeToString(def->driver.virtio.name));
|
virDomainNetBackendTypeToString(def->driver.virtio.name));
|
||||||
@ -29997,7 +29997,7 @@ virDomainDefFormat(virDomainDefPtr def,
|
|||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL);
|
||||||
if (virDomainDefFormatInternal(def, xmlopt, &buf, flags) < 0)
|
if (virDomainDefFormatInternal(def, xmlopt, &buf, flags) < 0)
|
||||||
|
@ -1122,11 +1122,10 @@ virInterfaceDefDevFormat(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virInterfaceDefFormat(const virInterfaceDef *def)
|
virInterfaceDefFormat(const virInterfaceDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virInterfaceDefDevFormat(&buf, def, VIR_INTERFACE_TYPE_LAST) < 0) {
|
if (virInterfaceDefDevFormat(&buf, def, VIR_INTERFACE_TYPE_LAST) < 0)
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
|
@ -2718,7 +2718,7 @@ virNetworkDefFormat(const virNetworkDef *def,
|
|||||||
virNetworkXMLOptionPtr xmlopt,
|
virNetworkXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0)
|
if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -2726,7 +2726,6 @@ virNetworkDefFormat(const virNetworkDef *def,
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ virNodeDeviceCapMdevDefFormat(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
virNodeDevCapsDefPtr caps;
|
virNodeDevCapsDefPtr caps;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@ printTCPFlags(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virNWFilterPrintTCPFlags(uint8_t flags)
|
virNWFilterPrintTCPFlags(uint8_t flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
printTCPFlags(&buf, flags);
|
printTCPFlags(&buf, flags);
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
@ -2561,7 +2561,7 @@ virNWFilterIsAllowedChain(const char *chainname)
|
|||||||
virNWFilterChainSuffixType i;
|
virNWFilterChainSuffixType i;
|
||||||
const char *name;
|
const char *name;
|
||||||
char *msg;
|
char *msg;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
bool printed = false;
|
bool printed = false;
|
||||||
|
|
||||||
if (!virNWFilterIsValidChainName(chainname))
|
if (!virNWFilterIsValidChainName(chainname))
|
||||||
@ -3044,7 +3044,7 @@ virNWFilterEntryFormat(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virNWFilterDefFormat(const virNWFilterDef *def)
|
virNWFilterDefFormat(const virNWFilterDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -3071,7 +3071,6 @@ virNWFilterDefFormat(const virNWFilterDef *def)
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
err_exit:
|
err_exit:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ virSecretDefFormatUsage(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virSecretDefFormat(const virSecretDef *def)
|
virSecretDefFormat(const virSecretDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
const unsigned char *uuid;
|
const unsigned char *uuid;
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
@ -301,6 +301,5 @@ virSecretDefFormat(const virSecretDef *def)
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ virDomainSnapshotDefFormat(const char *uuidstr,
|
|||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virCheckFlags(VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE |
|
virCheckFlags(VIR_DOMAIN_SNAPSHOT_FORMAT_SECURE |
|
||||||
VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL |
|
VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL |
|
||||||
|
@ -117,16 +117,14 @@ virStoragePoolCapsFormatPool(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virStoragePoolCapsFormat(const virStoragePoolCaps *caps)
|
virStoragePoolCapsFormat(const virStoragePoolCaps *caps)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<storagepoolCapabilities>\n");
|
virBufferAddLit(&buf, "<storagepoolCapabilities>\n");
|
||||||
virBufferAdjustIndent(&buf, 2);
|
virBufferAdjustIndent(&buf, 2);
|
||||||
for (i = 0; i < VIR_STORAGE_POOL_LAST; i++) {
|
for (i = 0; i < VIR_STORAGE_POOL_LAST; i++) {
|
||||||
if (virStoragePoolCapsFormatPool(&buf, i, caps) < 0) {
|
if (virStoragePoolCapsFormatPool(&buf, i, caps) < 0)
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
virBufferAdjustIndent(&buf, -2);
|
virBufferAdjustIndent(&buf, -2);
|
||||||
virBufferAddLit(&buf, "</storagepoolCapabilities>\n");
|
virBufferAddLit(&buf, "</storagepoolCapabilities>\n");
|
||||||
|
@ -1223,7 +1223,7 @@ virStoragePoolDefFormatBuf(virBufferPtr buf,
|
|||||||
char *
|
char *
|
||||||
virStoragePoolDefFormat(virStoragePoolDefPtr def)
|
virStoragePoolDefFormat(virStoragePoolDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virStoragePoolDefFormatBuf(&buf, def) < 0)
|
if (virStoragePoolDefFormatBuf(&buf, def) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -1231,7 +1231,6 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1594,7 +1593,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
|
|||||||
virStorageVolDefPtr def)
|
virStorageVolDefPtr def)
|
||||||
{
|
{
|
||||||
virStorageVolOptionsPtr options;
|
virStorageVolOptionsPtr options;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
options = virStorageVolOptionsForPoolType(pool->type);
|
options = virStorageVolOptionsForPoolType(pool->type);
|
||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
@ -1663,7 +1662,6 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1684,7 @@ int
|
|||||||
virStoragePoolSaveState(const char *stateFile,
|
virStoragePoolSaveState(const char *stateFile,
|
||||||
virStoragePoolDefPtr def)
|
virStoragePoolDefPtr def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<poolstate>\n");
|
virBufferAddLit(&buf, "<poolstate>\n");
|
||||||
@ -1743,7 +1741,7 @@ char *
|
|||||||
virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
|
virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
|
||||||
{
|
{
|
||||||
virStoragePoolOptionsPtr options;
|
virStoragePoolOptionsPtr options;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *type;
|
const char *type;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -1770,6 +1768,5 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -815,7 +815,7 @@ virNetworkObjFormat(virNetworkObjPtr obj,
|
|||||||
virNetworkXMLOptionPtr xmlopt,
|
virNetworkXMLOptionPtr xmlopt,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
char *classIdStr = virBitmapFormat(obj->classIdMap);
|
char *classIdStr = virBitmapFormat(obj->classIdMap);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -843,7 +843,6 @@ virNetworkObjFormat(virNetworkObjPtr obj,
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,12 +324,10 @@ virNetworkPortDefParseFile(const char *filename)
|
|||||||
char *
|
char *
|
||||||
virNetworkPortDefFormat(const virNetworkPortDef *def)
|
virNetworkPortDefFormat(const virNetworkPortDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virNetworkPortDefFormatBuf(&buf, def) < 0) {
|
if (virNetworkPortDefFormatBuf(&buf, def) < 0)
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
|
@ -223,12 +223,10 @@ virNWFilterBindingDefParseFile(const char *filename)
|
|||||||
char *
|
char *
|
||||||
virNWFilterBindingDefFormat(const virNWFilterBindingDef *def)
|
virNWFilterBindingDefFormat(const virNWFilterBindingDef *def)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virNWFilterBindingDefFormatBuf(&buf, def) < 0) {
|
if (virNWFilterBindingDefFormatBuf(&buf, def) < 0)
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
}
|
}
|
||||||
|
@ -284,16 +284,14 @@ virNWFilterBindingObjParseFile(const char *filename)
|
|||||||
char *
|
char *
|
||||||
virNWFilterBindingObjFormat(const virNWFilterBindingObj *obj)
|
virNWFilterBindingObjFormat(const virNWFilterBindingObj *obj)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<filterbindingstatus>\n");
|
virBufferAddLit(&buf, "<filterbindingstatus>\n");
|
||||||
|
|
||||||
virBufferAdjustIndent(&buf, 2);
|
virBufferAdjustIndent(&buf, 2);
|
||||||
|
|
||||||
if (virNWFilterBindingDefFormatBuf(&buf, obj->def) < 0) {
|
if (virNWFilterBindingDefFormatBuf(&buf, obj->def) < 0)
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAdjustIndent(&buf, -2);
|
virBufferAdjustIndent(&buf, -2);
|
||||||
virBufferAddLit(&buf, "</filterbindingstatus>\n");
|
virBufferAddLit(&buf, "</filterbindingstatus>\n");
|
||||||
|
@ -127,7 +127,7 @@ char *
|
|||||||
virSaveCookieFormat(virObjectPtr obj,
|
virSaveCookieFormat(virObjectPtr obj,
|
||||||
virSaveCookieCallbacksPtr saveCookie)
|
virSaveCookieCallbacksPtr saveCookie)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0)
|
if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -135,6 +135,5 @@ virSaveCookieFormat(virObjectPtr obj,
|
|||||||
return virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virBufferFreeAndReset(&buf);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user