Use g_autoptr instead of VIR_AUTOPTR

Since commit 44e7f02915
    util: rewrite auto cleanup macros to use glib's equivalent

VIR_AUTOPTR aliases to g_autoptr. Replace all of its use by the GLib
macro version.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2019-10-15 14:47:50 +02:00
parent 8334203f91
commit 45678bd70a
123 changed files with 527 additions and 527 deletions

View File

@ -70,7 +70,7 @@ int
virBhyveLoadDriverConfig(virBhyveDriverConfigPtr cfg,
const char *filename)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (access(filename, R_OK) == -1) {
VIR_INFO("Could not read bhyve config file %s", filename);

View File

@ -209,7 +209,7 @@ virDomainCheckpointDefParseNode(xmlDocPtr xml,
void *parseOpaque,
unsigned int flags)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autofree char *schema = NULL;
if (!virXMLNodeNameEqual(root, "domaincheckpoint")) {

View File

@ -2000,7 +2000,7 @@ virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
{
int maxvcpus = virDomainDefGetVcpusMax(def);
size_t i;
VIR_AUTOPTR(virBitmap) allcpumap = NULL;
g_autoptr(virBitmap) allcpumap = NULL;
if (hostcpus < 0)
return -1;
@ -3188,7 +3188,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def,
size_t i;
ssize_t nxt = -1;
virDomainIOThreadIDDefPtr iothrid = NULL;
VIR_AUTOPTR(virBitmap) thrmap = NULL;
g_autoptr(virBitmap) thrmap = NULL;
/* Same value (either 0 or some number), then we have none to fill in or
* the iothreadid array was filled from the XML
@ -7974,7 +7974,7 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode,
int auth_secret_usage = -1;
xmlNodePtr cur;
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &def->u.iscsi;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
/* For the purposes of command line creation, this needs to look
* like a disk storage source */
@ -9954,7 +9954,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_XPATH_NODE_AUTORESTORE(ctxt);
bool source = false;
virStorageEncryptionPtr encryption = NULL;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
g_autofree char *tmp = NULL;
g_autofree char *snapshot = NULL;
g_autofree char *rawio = NULL;
@ -16392,9 +16392,9 @@ virDomainDeviceDefParse(const char *xmlStr,
void *parseOpaque,
unsigned int flags)
{
VIR_AUTOPTR(xmlDoc) xml = NULL;
g_autoptr(xmlDoc) xml = NULL;
xmlNodePtr node;
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autofree virDomainDeviceDefPtr dev = NULL;
char *netprefix;
@ -16570,8 +16570,8 @@ virDomainDiskDefParse(const char *xmlStr,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
VIR_AUTOPTR(xmlDoc) xml = NULL;
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
virSecurityLabelDefPtr *seclabels = NULL;
size_t nseclabels = 0;
@ -18321,7 +18321,7 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node,
virDomainIOThreadIDDefPtr iothrid;
unsigned int iothreadid;
g_autofree char *tmp = NULL;
VIR_AUTOPTR(virBitmap) cpumask = NULL;
g_autoptr(virBitmap) cpumask = NULL;
if (!(tmp = virXMLPropString(node, "iothread"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@ -18386,7 +18386,7 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node)
{
virBitmapPtr ret = NULL;
g_autofree char *tmp = NULL;
VIR_AUTOPTR(virBitmap) def = NULL;
g_autoptr(virBitmap) def = NULL;
if (!(tmp = virXMLPropString(node, "cpuset"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -18790,7 +18790,7 @@ virDomainThreadSchedParseHelper(xmlNodePtr node,
virDomainThreadSchedParamPtr sched = NULL;
virProcessSchedPolicy policy = 0;
int priority = 0;
VIR_AUTOPTR(virBitmap) map = NULL;
g_autoptr(virBitmap) map = NULL;
if (!(map = virDomainSchedulerParse(node, name, &policy, &priority)))
return -1;
@ -19524,7 +19524,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
ssize_t i = 0;
int n;
int ret = -1;
VIR_AUTOPTR(virBitmap) vcpus = NULL;
g_autoptr(virBitmap) vcpus = NULL;
g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL;
@ -19722,7 +19722,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
{
VIR_XPATH_NODE_AUTORESTORE(ctxt);
virDomainResctrlDefPtr resctrl = NULL;
VIR_AUTOPTR(virBitmap) vcpus = NULL;
g_autoptr(virBitmap) vcpus = NULL;
g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL;
ssize_t i = 0;
@ -21662,8 +21662,8 @@ virDomainDefParseNode(xmlDocPtr xml,
void *parseOpaque,
unsigned int flags)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
VIR_AUTOPTR(virDomainDef) def = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(virDomainDef) def = NULL;
if (!(ctxt = virXMLXPathContextNew(xml)))
return NULL;
@ -21692,7 +21692,7 @@ virDomainObjParseNode(xmlDocPtr xml,
virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "domstatus")) {
virReportError(VIR_ERR_XML_ERROR,
@ -30634,7 +30634,7 @@ virNetworkPortDefPtr
virDomainNetDefToNetworkPort(virDomainDefPtr dom,
virDomainNetDefPtr iface)
{
VIR_AUTOPTR(virNetworkPortDef) port = NULL;
g_autoptr(virNetworkPortDef) port = NULL;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -30793,7 +30793,7 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom,
virDomainNetDefPtr iface)
{
virDomainActualNetDefPtr actual;
VIR_AUTOPTR(virNetworkPortDef) port = NULL;
g_autoptr(virNetworkPortDef) port = NULL;
if (!iface->data.network.actual) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -30937,7 +30937,7 @@ virDomainNetCreatePort(virConnectPtr conn,
{
virErrorPtr save_err;
VIR_AUTOUNREF(virNetworkPtr) net = NULL;
VIR_AUTOPTR(virNetworkPortDef) portdef = NULL;
g_autoptr(virNetworkPortDef) portdef = NULL;
VIR_AUTOUNREF(virNetworkPortPtr) port = NULL;
g_autofree char *portxml = NULL;
@ -31342,7 +31342,7 @@ int
virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
{
virStorageVolInfo info;
VIR_AUTOPTR(virStoragePoolDef) pooldef = NULL;
g_autoptr(virStoragePoolDef) pooldef = NULL;
g_autofree char *poolxml = NULL;
VIR_AUTOUNREF(virConnectPtr) conn = NULL;
VIR_AUTOUNREF(virStoragePoolPtr) pool = NULL;

View File

@ -819,7 +819,7 @@ virInterfaceDefPtr
virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "interface")) {
virReportError(VIR_ERR_XML_ERROR,

View File

@ -2114,7 +2114,7 @@ virNetworkDefParseNode(xmlDocPtr xml,
xmlNodePtr root,
virNetworkXMLOptionPtr xmlopt)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "network")) {
virReportError(VIR_ERR_XML_ERROR,
@ -3635,8 +3635,8 @@ virNetworkDefUpdateSection(virNetworkDefPtr def,
const char *xml,
unsigned int flags) /* virNetworkUpdateFlags */
{
VIR_AUTOPTR(xmlDoc) doc = NULL;
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!(doc = virXMLParseStringCtxt(xml, _("network_update_xml"), &ctxt)))
return -1;

View File

@ -2052,7 +2052,7 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
int create,
const char *virt_type)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "device")) {
virReportError(VIR_ERR_XML_ERROR,

View File

@ -2746,7 +2746,7 @@ virNWFilterDefPtr
virNWFilterDefParseNode(xmlDocPtr xml,
xmlNodePtr root)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (STRNEQ((const char *)root->name, "filter")) {
virReportError(VIR_ERR_XML_ERROR,

View File

@ -131,8 +131,8 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
static virSecretDefPtr
secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
VIR_AUTOPTR(virSecretDef) def = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(virSecretDef) def = NULL;
g_autofree char *prop = NULL;
g_autofree char *uuidstr = NULL;

View File

@ -429,7 +429,7 @@ virDomainSnapshotDefParseNode(xmlDocPtr xml,
bool *current,
unsigned int flags)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "domainsnapshot")) {
virReportError(VIR_ERR_XML_ERROR, "%s", _("domainsnapshot"));

View File

@ -534,7 +534,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
size_t i;
virStoragePoolOptionsPtr options;
int n;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
g_autofree char *port = NULL;
g_autofree char *ver = NULL;
g_autofree xmlNodePtr *nodeset = NULL;
@ -695,10 +695,10 @@ virStoragePoolSourcePtr
virStoragePoolDefParseSourceString(const char *srcSpec,
int pool_type)
{
VIR_AUTOPTR(xmlDoc) doc = NULL;
g_autoptr(xmlDoc) doc = NULL;
xmlNodePtr node = NULL;
VIR_AUTOPTR(xmlXPathContext) xpath_ctxt = NULL;
VIR_AUTOPTR(virStoragePoolSource) def = NULL;
g_autoptr(xmlXPathContext) xpath_ctxt = NULL;
g_autoptr(virStoragePoolSource) def = NULL;
if (!(doc = virXMLParseStringCtxt(srcSpec,
_("(storage_source_specification)"),
@ -849,7 +849,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
virStoragePoolOptionsPtr options;
virStoragePoolDefPtr ret = NULL;
xmlNodePtr source_node;
VIR_AUTOPTR(virStoragePoolDef) def = NULL;
g_autoptr(virStoragePoolDef) def = NULL;
g_autofree char *type = NULL;
g_autofree char *uuid = NULL;
g_autofree char *target_path = NULL;
@ -1007,7 +1007,7 @@ virStoragePoolDefPtr
virStoragePoolDefParseNode(xmlDocPtr xml,
xmlNodePtr root)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "pool")) {
virReportError(VIR_ERR_XML_ERROR,
@ -1278,7 +1278,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
xmlNodePtr node;
size_t i;
int n;
VIR_AUTOPTR(virStorageVolDef) def = NULL;
g_autoptr(virStorageVolDef) def = NULL;
g_autofree char *type = NULL;
g_autofree char *allocation = NULL;
g_autofree char *capacity = NULL;
@ -1444,7 +1444,7 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool,
xmlNodePtr root,
unsigned int flags)
{
VIR_AUTOPTR(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (!virXMLNodeNameEqual(root, "volume")) {
virReportError(VIR_ERR_XML_ERROR,

View File

@ -1887,7 +1887,7 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net,
int ret = -1;
int rc;
char uuidstr[VIR_UUID_STRING_BUFLEN];
VIR_AUTOPTR(virNetworkPortDef) portdef = NULL;
g_autoptr(virNetworkPortDef) portdef = NULL;
if (!(dir = virNetworkObjGetPortStatusDir(net, stateDir)))
goto cleanup;

View File

@ -75,7 +75,7 @@ virNetworkPortDefFree(virNetworkPortDefPtr def)
static virNetworkPortDefPtr
virNetworkPortDefParseXML(xmlXPathContextPtr ctxt)
{
VIR_AUTOPTR(virNetworkPortDef) def = NULL;
g_autoptr(virNetworkPortDef) def = NULL;
g_autofree char *uuid = NULL;
xmlNodePtr virtPortNode;
xmlNodePtr vlanNode;

View File

@ -1624,7 +1624,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
const char *autostartLink)
{
virStoragePoolObjPtr obj;
VIR_AUTOPTR(virStoragePoolDef) def = NULL;
g_autoptr(virStoragePoolDef) def = NULL;
if (!(def = virStoragePoolDefParseFile(path)))
return NULL;
@ -1671,7 +1671,7 @@ virStoragePoolObjLoadState(virStoragePoolObjListPtr pools,
xmlDocPtr xml = NULL;
xmlXPathContextPtr ctxt = NULL;
xmlNodePtr node = NULL;
VIR_AUTOPTR(virStoragePoolDef) def = NULL;
g_autoptr(virStoragePoolDef) def = NULL;
if (!(stateFile = virFileBuildPath(stateDir, name, ".xml")))
return NULL;

View File

@ -851,7 +851,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
char *taskInfoErrorMessage = NULL;
char *uuid_string = NULL;
char *key = NULL;
VIR_AUTOPTR(virStorageVolDef) def = NULL;
g_autoptr(virStorageVolDef) def = NULL;
virCheckFlags(0, NULL);
@ -1067,7 +1067,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
char *taskInfoErrorMessage = NULL;
char *uuid_string = NULL;
char *key = NULL;
VIR_AUTOPTR(virStorageVolDef) def = NULL;
g_autoptr(virStorageVolDef) def = NULL;
virCheckFlags(0, NULL);

View File

@ -222,7 +222,7 @@ virAdmConnectOpen(const char *name, unsigned int flags)
char *sock_path = NULL;
char *alias = NULL;
virAdmConnectPtr conn = NULL;
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
char *uristr = NULL;
if (virAdmInitialize() < 0)

View File

@ -856,7 +856,7 @@ virConnectOpenInternal(const char *name,
size_t i;
int res;
virConnectPtr ret;
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
char *uristr = NULL;
ret = virGetConnect();

View File

@ -1868,7 +1868,7 @@ libxlDriverConfigGet(libxlDriverPrivatePtr driver)
int libxlDriverConfigLoadFile(libxlDriverConfigPtr cfg,
const char *filename)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
/* defaults for keepalive messages */
cfg->keepAliveInterval = 5;

View File

@ -2681,7 +2681,7 @@ libxlConnectDomainXMLFromNative(virConnectPtr conn,
libxlDriverPrivatePtr driver = conn->privateData;
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainDefPtr def = NULL;
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
char *xml = NULL;
virCheckFlags(0, NULL);
@ -2731,7 +2731,7 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
libxlDriverPrivatePtr driver = conn->privateData;
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
virDomainDefPtr def = NULL;
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
int len = MAX_CONFIG_SIZE;
char *ret = NULL;

View File

@ -2205,7 +2205,7 @@ xenFormatXLDomainChannels(virConfPtr conf, virDomainDefPtr def)
virConfPtr
xenFormatXL(virDomainDefPtr def, virConnectPtr conn)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;

View File

@ -599,7 +599,7 @@ virConfPtr
xenFormatXM(virConnectPtr conn,
virDomainDefPtr def)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;

View File

@ -1283,7 +1283,7 @@ int main(int argc, char **argv) {
* (but still need to add @lockProgram into @srv). rv == 0 means that no
* saved state is present, therefore initialize from scratch here. */
if (rv == 0) {
VIR_AUTOPTR(virSystemdActivation) act = NULL;
g_autoptr(virSystemdActivation) act = NULL;
virSystemdActivationMap actmap[] = {
{ .name = "virtlockd.socket", .family = AF_UNIX, .path = sock_file },
{ .name = "virtlockd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },

View File

@ -114,7 +114,7 @@ virLockDaemonConfigLoadFile(virLockDaemonConfigPtr data,
const char *filename,
bool allow_missing)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (allow_missing &&
access(filename, R_OK) == -1 &&

View File

@ -81,7 +81,7 @@ static virLockManagerLockDaemonDriverPtr driver;
static int virLockManagerLockDaemonLoadConfig(const char *configFile)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (access(configFile, R_OK) == -1) {
if (errno != ENOENT) {

View File

@ -119,7 +119,7 @@ static int
virLockManagerSanlockLoadConfig(virLockManagerSanlockDriverPtr driver,
const char *configFile)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
int ret = -1;
char *user = NULL;
char *group = NULL;

View File

@ -1056,7 +1056,7 @@ int main(int argc, char **argv) {
* scratch if rv == 0
*/
if (rv == 0) {
VIR_AUTOPTR(virSystemdActivation) act = NULL;
g_autoptr(virSystemdActivation) act = NULL;
virSystemdActivationMap actmap[] = {
{ .name = "virtlogd.socket", .family = AF_UNIX, .path = sock_file },
{ .name = "virtlogd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },

View File

@ -120,7 +120,7 @@ virLogDaemonConfigLoadFile(virLogDaemonConfigPtr data,
const char *filename,
bool allow_missing)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (allow_missing &&
access(filename, R_OK) == -1 &&

View File

@ -252,7 +252,7 @@ int
virLXCLoadDriverConfig(virLXCDriverConfigPtr cfg,
const char *filename)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
/* Avoid error from non-existent or unreadable file. */
if (access(filename, R_OK) == -1)

View File

@ -1079,7 +1079,7 @@ lxcParseConfigString(const char *config,
virDomainXMLOptionPtr xmlopt)
{
virDomainDefPtr vmdef = NULL;
VIR_AUTOPTR(virConf) properties = NULL;
g_autoptr(virConf) properties = NULL;
g_autofree char *value = NULL;
if (!(properties = virConfReadString(config, VIR_CONF_FLAG_LXC_FORMAT)))

View File

@ -5566,7 +5566,7 @@ networkPortCreateXML(virNetworkPtr net,
virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr obj;
virNetworkDefPtr def;
VIR_AUTOPTR(virNetworkPortDef) portdef = NULL;
g_autoptr(virNetworkPortDef) portdef = NULL;
virNetworkPortPtr ret = NULL;
int rc;

View File

@ -1965,8 +1965,8 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
virStorageVolPtr vol = NULL;
virStorageVolPtr dup_vol = NULL;
char *key = NULL;
VIR_AUTOPTR(virStorageVolDef) voldef = NULL;
VIR_AUTOPTR(virStoragePoolDef) spdef = NULL;
g_autoptr(virStorageVolDef) voldef = NULL;
g_autoptr(virStoragePoolDef) spdef = NULL;
if (VIR_ALLOC(spdef) < 0)
return NULL;

View File

@ -2043,8 +2043,8 @@ qemuAgentGetFSInfoInternal(qemuAgentPtr mon,
{
size_t i;
int ret = -1;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data;
size_t ndata = 0;
qemuAgentFSInfoPtr *info_ret = NULL;
@ -2550,8 +2550,8 @@ qemuAgentGetUsers(qemuAgentPtr mon,
int *nparams,
int *maxparams)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data = NULL;
size_t ndata;
size_t i;
@ -2642,8 +2642,8 @@ qemuAgentGetOSInfo(qemuAgentPtr mon,
int *nparams,
int *maxparams)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data = NULL;
if (!(cmd = qemuAgentMakeCommand("guest-get-osinfo", NULL)))
@ -2696,8 +2696,8 @@ qemuAgentGetTimezone(qemuAgentPtr mon,
int *nparams,
int *maxparams)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data = NULL;
const char *name;
int offset;

View File

@ -130,7 +130,7 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next,
virHashTablePtr nodenamestable,
qemuBlockNodeNameBackingChainDataPtr *nodenamedata)
{
VIR_AUTOPTR(qemuBlockNodeNameBackingChainData) data = NULL;
g_autoptr(qemuBlockNodeNameBackingChainData) data = NULL;
qemuBlockNodeNameBackingChainDataPtr backingdata = NULL;
virJSONValuePtr backing = virJSONValueObjectGetObject(next, "backing");
virJSONValuePtr parent = virJSONValueObjectGetObject(next, "parent");
@ -198,7 +198,7 @@ qemuBlockNodeNameGetBackingChainDisk(size_t pos G_GNUC_UNUSED,
{
struct qemuBlockNodeNameGetBackingChainData *data = opaque;
const char *device = virJSONValueObjectGetString(item, "device");
VIR_AUTOPTR(qemuBlockNodeNameBackingChainData) devicedata = NULL;
g_autoptr(qemuBlockNodeNameBackingChainData) devicedata = NULL;
if (qemuBlockNodeNameGetBackingChainBacking(item, data->nodenamestable,
&devicedata) < 0)
@ -231,8 +231,8 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodes,
virJSONValuePtr blockstats)
{
struct qemuBlockNodeNameGetBackingChainData data;
VIR_AUTOPTR(virHashTable) namednodestable = NULL;
VIR_AUTOPTR(virHashTable) disks = NULL;
g_autoptr(virHashTable) namednodestable = NULL;
g_autoptr(virHashTable) disks = NULL;
memset(&data, 0, sizeof(data));
@ -327,9 +327,9 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOPTR(virHashTable) disktable = NULL;
VIR_AUTOPTR(virJSONValue) data = NULL;
VIR_AUTOPTR(virJSONValue) blockstats = NULL;
g_autoptr(virHashTable) disktable = NULL;
g_autoptr(virJSONValue) data = NULL;
g_autoptr(virJSONValue) blockstats = NULL;
virDomainDiskDefPtr disk;
size_t i;
@ -371,7 +371,7 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
virHashTablePtr
qemuBlockGetNodeData(virJSONValuePtr data)
{
VIR_AUTOPTR(virHashTable) nodedata = NULL;
g_autoptr(virHashTable) nodedata = NULL;
if (!(nodedata = virHashCreate(50, virJSONValueHashFree)))
return NULL;
@ -408,7 +408,7 @@ qemuBlockStorageSourceSupportsConcurrentAccess(virStorageSourcePtr src)
virURIPtr
qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
{
VIR_AUTOPTR(virURI) uri = NULL;
g_autoptr(virURI) uri = NULL;
if (src->nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -470,7 +470,7 @@ static virJSONValuePtr
qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host,
bool legacy)
{
VIR_AUTOPTR(virJSONValue) server = NULL;
g_autoptr(virJSONValue) server = NULL;
const char *transport;
const char *field;
g_autofree char *port = NULL;
@ -530,8 +530,8 @@ static virJSONValuePtr
qemuBlockStorageSourceBuildHostsJSONSocketAddress(virStorageSourcePtr src,
bool legacy)
{
VIR_AUTOPTR(virJSONValue) servers = NULL;
VIR_AUTOPTR(virJSONValue) server = NULL;
g_autoptr(virJSONValue) servers = NULL;
g_autoptr(virJSONValue) server = NULL;
virStorageNetHostDefPtr host;
size_t i;
@ -597,8 +597,8 @@ qemuBlockStorageSourceBuildJSONInetSocketAddress(virStorageNetHostDefPtr host)
static virJSONValuePtr
qemuBlockStorageSourceBuildHostsJSONInetSocketAddress(virStorageSourcePtr src)
{
VIR_AUTOPTR(virJSONValue) servers = NULL;
VIR_AUTOPTR(virJSONValue) server = NULL;
g_autoptr(virJSONValue) servers = NULL;
g_autoptr(virJSONValue) server = NULL;
virStorageNetHostDefPtr host;
size_t i;
@ -626,8 +626,8 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src,
bool legacy,
bool onlytarget)
{
VIR_AUTOPTR(virJSONValue) servers = NULL;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) servers = NULL;
g_autoptr(virJSONValue) props = NULL;
if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, legacy)))
return NULL;
@ -657,7 +657,7 @@ static virJSONValuePtr
qemuBlockStorageSourceGetVxHSProps(virStorageSourcePtr src,
bool onlytarget)
{
VIR_AUTOPTR(virJSONValue) server = NULL;
g_autoptr(virJSONValue) server = NULL;
const char *tlsAlias = src->tlsAlias;
virJSONValuePtr ret = NULL;
@ -696,7 +696,7 @@ qemuBlockStorageSourceGetCURLProps(virStorageSourcePtr src,
const char *passwordalias = NULL;
const char *username = NULL;
virJSONValuePtr ret = NULL;
VIR_AUTOPTR(virURI) uri = NULL;
g_autoptr(virURI) uri = NULL;
g_autofree char *uristr = NULL;
/**
@ -804,7 +804,7 @@ static virJSONValuePtr
qemuBlockStorageSourceGetNBDProps(virStorageSourcePtr src,
bool onlytarget)
{
VIR_AUTOPTR(virJSONValue) serverprops = NULL;
g_autoptr(virJSONValue) serverprops = NULL;
const char *tlsAlias = src->tlsAlias;
virJSONValuePtr ret = NULL;
@ -838,11 +838,11 @@ qemuBlockStorageSourceGetRBDProps(virStorageSourcePtr src,
bool onlytarget)
{
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
VIR_AUTOPTR(virJSONValue) servers = NULL;
g_autoptr(virJSONValue) servers = NULL;
virJSONValuePtr ret = NULL;
const char *username = NULL;
VIR_AUTOPTR(virJSONValue) authmodes = NULL;
VIR_AUTOPTR(virJSONValue) mode = NULL;
g_autoptr(virJSONValue) authmodes = NULL;
g_autoptr(virJSONValue) mode = NULL;
const char *keysecret = NULL;
if (src->nhosts > 0 &&
@ -888,7 +888,7 @@ qemuBlockStorageSourceGetRBDProps(virStorageSourcePtr src,
static virJSONValuePtr
qemuBlockStorageSourceGetSheepdogProps(virStorageSourcePtr src)
{
VIR_AUTOPTR(virJSONValue) serverprops = NULL;
g_autoptr(virJSONValue) serverprops = NULL;
virJSONValuePtr ret = NULL;
if (src->nhosts != 1) {
@ -916,7 +916,7 @@ qemuBlockStorageSourceGetSheepdogProps(virStorageSourcePtr src)
static virJSONValuePtr
qemuBlockStorageSourceGetSshProps(virStorageSourcePtr src)
{
VIR_AUTOPTR(virJSONValue) serverprops = NULL;
g_autoptr(virJSONValue) serverprops = NULL;
virJSONValuePtr ret = NULL;
const char *username = NULL;
@ -973,7 +973,7 @@ static virJSONValuePtr
qemuBlockStorageSourceGetVvfatProps(virStorageSourcePtr src,
bool onlytarget)
{
VIR_AUTOPTR(virJSONValue) ret = NULL;
g_autoptr(virJSONValue) ret = NULL;
/* libvirt currently does not handle the following attributes:
* '*fat-type': 'int'
@ -997,7 +997,7 @@ static int
qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSourcePtr src,
virJSONValuePtr props)
{
VIR_AUTOPTR(virJSONValue) cacheobj = NULL;
g_autoptr(virJSONValue) cacheobj = NULL;
bool direct = false;
bool noflush = false;
@ -1038,7 +1038,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src,
bool autoreadonly)
{
int actualType = virStorageSourceGetActualType(src);
VIR_AUTOPTR(virJSONValue) fileprops = NULL;
g_autoptr(virJSONValue) fileprops = NULL;
const char *driver = NULL;
virTristateBool aro = VIR_TRISTATE_BOOL_ABSENT;
virTristateBool ro = VIR_TRISTATE_BOOL_ABSENT;
@ -1244,7 +1244,7 @@ qemuBlockStorageSourceGetFormatQcowGenericProps(virStorageSourcePtr src,
const char *format,
virJSONValuePtr props)
{
VIR_AUTOPTR(virJSONValue) encprops = NULL;
g_autoptr(virJSONValue) encprops = NULL;
if (qemuBlockStorageSourceGetCryptoProps(src, &encprops) < 0)
return -1;
@ -1289,7 +1289,7 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSourcePtr src)
const char *discard = NULL;
int detectZeroesMode = virDomainDiskGetDetectZeroesMode(src->discard,
src->detect_zeroes);
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (qemuBlockNodeNameValidate(src->nodeformat) < 0)
return NULL;
@ -1323,7 +1323,7 @@ static virJSONValuePtr
qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src)
{
const char *driver = NULL;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (!(props = qemuBlockStorageSourceGetBlockdevFormatCommonProps(src)))
return NULL;
@ -1405,7 +1405,7 @@ virJSONValuePtr
qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src,
virStorageSourcePtr backingStore)
{
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (!(props = qemuBlockStorageSourceGetBlockdevFormatProps(src)))
return NULL;
@ -1481,7 +1481,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
virStorageSourcePtr backingStore,
bool autoreadonly)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
if (VIR_ALLOC(data) < 0)
return NULL;
@ -1668,7 +1668,7 @@ qemuBlockStorageSourceDetachPrepare(virStorageSourcePtr src,
char *driveAlias)
{
qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
qemuBlockStorageSourceAttachDataPtr ret = NULL;
if (VIR_ALLOC(data) < 0)
@ -1738,8 +1738,8 @@ qemuBlockStorageSourceChainDataFree(qemuBlockStorageSourceChainDataPtr data)
qemuBlockStorageSourceChainDataPtr
qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSourcePtr src)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) backend = NULL;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
virStorageSourcePtr n;
if (VIR_ALLOC(data) < 0)
@ -1769,8 +1769,8 @@ qemuBlockStorageSourceChainDataPtr
qemuBlockStorageSourceChainDetachPrepareDrive(virStorageSourcePtr src,
char *driveAlias)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) backend = NULL;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
if (VIR_ALLOC(data) < 0)
return NULL;
@ -1928,8 +1928,8 @@ char *
qemuBlockGetBackingStoreString(virStorageSourcePtr src)
{
int actualType = virStorageSourceGetActualType(src);
VIR_AUTOPTR(virJSONValue) backingProps = NULL;
VIR_AUTOPTR(virURI) uri = NULL;
g_autoptr(virJSONValue) backingProps = NULL;
g_autoptr(virURI) uri = NULL;
g_autofree char *backingJSON = NULL;
char *ret = NULL;
@ -2022,7 +2022,7 @@ qemuBlockStorageSourceCreateGetFormatPropsGeneric(virStorageSourcePtr src,
virJSONValuePtr *retprops,
virStorageSourcePtr backing)
{
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props,
"s:driver", driver,
@ -2045,7 +2045,7 @@ qemuBlockStorageSourceCreateGetEncryptionLUKS(virStorageSourcePtr src,
virJSONValuePtr *luksProps)
{
qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
g_autofree char *cipheralg = NULL;
const char *keysecret = NULL;
@ -2085,7 +2085,7 @@ static int
qemuBlockStorageSourceCreateGetFormatPropsLUKS(virStorageSourcePtr src,
virJSONValuePtr *props)
{
VIR_AUTOPTR(virJSONValue) luksprops = NULL;
g_autoptr(virJSONValue) luksprops = NULL;
if (qemuBlockStorageSourceCreateGetEncryptionLUKS(src, &luksprops) < 0)
return -1;
@ -2106,7 +2106,7 @@ static int
qemuBlockStorageSourceCreateAddEncryptionQcow(virStorageSourcePtr src,
virJSONValuePtr props)
{
VIR_AUTOPTR(virJSONValue) encryptProps = NULL;
g_autoptr(virJSONValue) encryptProps = NULL;
if (!src->encryption)
return 0;
@ -2135,7 +2135,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSourcePtr src,
virStorageSourcePtr backing,
virJSONValuePtr *props)
{
VIR_AUTOPTR(virJSONValue) qcow2props = NULL;
g_autoptr(virJSONValue) qcow2props = NULL;
const char *qcow2version = NULL;
if (STREQ_NULLABLE(src->compat, "0.10"))
@ -2165,7 +2165,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow(virStorageSourcePtr src,
virStorageSourcePtr backing,
virJSONValuePtr *props)
{
VIR_AUTOPTR(virJSONValue) qcowprops = NULL;
g_autoptr(virJSONValue) qcowprops = NULL;
if (virJSONValueObjectCreate(&qcowprops,
"s:driver", "qcow",
@ -2188,7 +2188,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQed(virStorageSourcePtr src,
virStorageSourcePtr backing,
virJSONValuePtr *props)
{
VIR_AUTOPTR(virJSONValue) qedprops = NULL;
g_autoptr(virJSONValue) qedprops = NULL;
if (virJSONValueObjectCreate(&qedprops,
"s:driver", "qed",
@ -2300,7 +2300,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSourcePtr src,
virJSONValuePtr *props)
{
int actualType = virStorageSourceGetActualType(src);
VIR_AUTOPTR(virJSONValue) location = NULL;
g_autoptr(virJSONValue) location = NULL;
const char *driver = NULL;
const char *filename = NULL;
@ -2382,7 +2382,7 @@ qemuBlockStorageSourceCreateGeneric(virDomainObjPtr vm,
bool storageCreate,
qemuDomainAsyncJob asyncJob)
{
VIR_AUTOPTR(virJSONValue) props = createProps;
g_autoptr(virJSONValue) props = createProps;
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuBlockJobDataPtr job = NULL;
int ret = -1;
@ -2438,7 +2438,7 @@ qemuBlockStorageSourceCreateStorage(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob)
{
int actualType = virStorageSourceGetActualType(src);
VIR_AUTOPTR(virJSONValue) createstorageprops = NULL;
g_autoptr(virJSONValue) createstorageprops = NULL;
int ret;
/* We create local files directly to be able to apply security labels
@ -2474,7 +2474,7 @@ qemuBlockStorageSourceCreateFormat(virDomainObjPtr vm,
virStorageSourcePtr chain,
qemuDomainAsyncJob asyncJob)
{
VIR_AUTOPTR(virJSONValue) createformatprops = NULL;
g_autoptr(virJSONValue) createformatprops = NULL;
int ret;
if (src->format == VIR_STORAGE_FILE_RAW)
@ -2595,7 +2595,7 @@ qemuBlockStorageSourceCreateDetectSize(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOPTR(virHashTable) stats = NULL;
g_autoptr(virHashTable) stats = NULL;
qemuBlockStatsPtr entry;
int rc;

View File

@ -797,7 +797,7 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob,
virStorageSourcePtr chain)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
if (!(data = qemuBlockStorageSourceChainDetachPrepareBlockdev(chain)))
return;
@ -1212,7 +1212,7 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver,
qemuBlockJobDataPtr job,
qemuDomainAsyncJob asyncJob)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) backend = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
/* if there is a synchronous client waiting for this job that means that
* it will handle further hotplug of the created volume and also that

View File

@ -1580,7 +1580,7 @@ static int
virQEMUCapsSEVInfoCopy(virSEVCapabilityPtr *dst,
virSEVCapabilityPtr src)
{
VIR_AUTOPTR(virSEVCapability) tmp = NULL;
g_autoptr(virSEVCapability) tmp = NULL;
if (VIR_ALLOC(tmp) < 0 ||
VIR_STRDUP(tmp->pdh, src->pdh) < 0 ||
@ -3576,7 +3576,7 @@ virQEMUCapsCachePrivFree(void *privData)
static int
virQEMUCapsParseSEVInfo(virQEMUCapsPtr qemuCaps, xmlXPathContextPtr ctxt)
{
VIR_AUTOPTR(virSEVCapability) sev = NULL;
g_autoptr(virSEVCapability) sev = NULL;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST))
return 0;
@ -5583,7 +5583,7 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsPtr domCaps)
{
virSEVCapability *cap = qemuCaps->sevCapabilities;
VIR_AUTOPTR(virSEVCapability) sev = NULL;
g_autoptr(virSEVCapability) sev = NULL;
if (!cap)
return 0;

View File

@ -159,7 +159,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
parentdef = virDomainCheckpointObjGetDef(moment);
for (j = 0; j < parentdef->ndisks; j++) {
virDomainCheckpointDiskDef *disk2;
VIR_AUTOPTR(virJSONValue) arr = NULL;
g_autoptr(virJSONValue) arr = NULL;
disk2 = &parentdef->disks[j];
if (STRNEQ(disk->name, disk2->name) ||
@ -356,7 +356,7 @@ qemuCheckpointCreateXML(virDomainPtr domain,
virDomainMomentObjPtr other = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = NULL;
VIR_AUTOUNREF(virCapsPtr) caps = NULL;
VIR_AUTOPTR(virJSONValue) actions = NULL;
g_autoptr(virJSONValue) actions = NULL;
int ret;
VIR_AUTOUNREF(virDomainCheckpointDefPtr) def = NULL;

View File

@ -731,7 +731,7 @@ qemuBuildObjectSecretCommandLine(virCommandPtr cmd,
qemuDomainSecretInfoPtr secinfo)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (qemuBuildSecretInfoProps(secinfo, &props) < 0)
return -1;
@ -922,7 +922,7 @@ qemuBuildTLSx509CommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (qemuBuildTLSx509BackendProps(tlspath, isListen, verifypeer, alias,
certEncSecretAlias, qemuCaps, &props) < 0)
@ -942,7 +942,7 @@ static char *
qemuBuildNetworkDriveURI(virStorageSourcePtr src,
qemuDomainSecretInfoPtr secinfo)
{
VIR_AUTOPTR(virURI) uri = NULL;
g_autoptr(virURI) uri = NULL;
if (!(uri = qemuBlockStorageSourceGetURI(src)))
return NULL;
@ -1557,7 +1557,7 @@ qemuDiskSourceNeedsProps(virStorageSourcePtr src,
static virJSONValuePtr
qemuDiskSourceGetProps(virStorageSourcePtr src)
{
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
virJSONValuePtr ret;
if (!(props = qemuBlockStorageSourceGetBackendProps(src, true, false, false)))
@ -1600,7 +1600,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
qemuDomainSecretInfoPtr secinfo = NULL;
qemuDomainSecretInfoPtr encinfo = NULL;
VIR_AUTOPTR(virJSONValue) srcprops = NULL;
g_autoptr(virJSONValue) srcprops = NULL;
g_autofree char *source = NULL;
bool rawluks = false;
@ -2477,8 +2477,8 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
VIR_AUTOPTR(virJSONValue) copyOnReadProps = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(virJSONValue) copyOnReadProps = NULL;
g_autofree char *copyOnReadPropsStr = NULL;
size_t i;
@ -3330,7 +3330,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
bool prealloc = false;
virBitmapPtr nodemask = NULL;
int rc;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
bool nodeSpecified = virDomainNumatuneNodeSpecified(def->numa, mem->targetNode);
unsigned long long pagesize = mem->pagesize;
bool needHugepage = !!pagesize;
@ -3584,7 +3584,7 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
qemuDomainObjPrivatePtr priv,
virBufferPtr buf)
{
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
g_autofree char *alias = NULL;
int rc;
virDomainMemoryDef mem = { 0 };
@ -3616,7 +3616,7 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
virQEMUDriverConfigPtr cfg,
qemuDomainObjPrivatePtr priv)
{
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
g_autofree char *alias = NULL;
if (!mem->info.alias) {
@ -4933,7 +4933,7 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *netsource = NULL;
VIR_AUTOPTR(virJSONValue) srcprops = NULL;
g_autoptr(virJSONValue) srcprops = NULL;
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
qemuDomainStorageSourcePrivatePtr srcPriv =
@ -5887,7 +5887,7 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager,
size_t i;
for (i = 0; i < def->nrngs; i++) {
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
virDomainRNGDefPtr rng = def->rngs[i];
g_autofree char *chardev = NULL;
@ -9000,7 +9000,7 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
virQEMUCapsPtr qemuCaps,
bool chardevStdioLogd)
{
VIR_AUTOPTR(virJSONValue) memProps = NULL;
g_autoptr(virJSONValue) memProps = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *devstr = NULL;
g_autofree char *chardev = NULL;
@ -9991,7 +9991,7 @@ qemuBuildManagedPRCommandLine(virCommandPtr cmd,
qemuDomainObjPrivatePtr priv)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (!virDomainDefHasManagedPR(def))
return 0;
@ -10050,7 +10050,7 @@ qemuBuildDBusVMStateCommandLineEach(void *payload,
qemuBuildDBusVMStateCommandLineData *data = user_data;
qemuDBusVMStatePtr vms = payload;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
if (!(props = qemuBuildDBusVMStateInfoProps(id, vms->addr)))
return -1;
@ -10276,7 +10276,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
{
size_t i;
char uuid[VIR_UUID_STRING_BUFLEN];
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
unsigned int bootHostdevNet = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
@ -10715,7 +10715,7 @@ virJSONValuePtr
qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
{
qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
VIR_AUTOPTR(virJSONValue) ret = NULL;
g_autoptr(virJSONValue) ret = NULL;
if (!(ret = virJSONValueCopy(vcpupriv->props)))
return NULL;
@ -10741,7 +10741,7 @@ qemuBlockStorageSourceAttachDataPtr
qemuBuildStorageSourceAttachPrepareDrive(virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
qemuBlockStorageSourceAttachDataPtr ret = NULL;
if (VIR_ALLOC(data) < 0)
@ -10809,8 +10809,8 @@ qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) elem = NULL;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
if (VIR_ALLOC(data) < 0)
return NULL;
@ -10834,7 +10834,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevOne(qemuBlockStorageSourceChainD
virStorageSourcePtr backingStore,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) elem = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) elem = NULL;
if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, backingStore, true)))
return -1;
@ -10861,7 +10861,7 @@ qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
virStorageSourcePtr n;
if (VIR_ALLOC(data) < 0)
@ -10892,7 +10892,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top,
virStorageSourcePtr backingStore,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
if (VIR_ALLOC(data) < 0)
return NULL;

View File

@ -1000,7 +1000,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
const char *filename,
bool privileged)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
/* Just check the file is readable before opening it, otherwise
* libvirt emits an error.

View File

@ -37,7 +37,7 @@ VIR_LOG_INIT("qemu.dbus");
qemuDBusVMStatePtr
qemuDBusVMStateNew(const char *id, const char *addr)
{
VIR_AUTOPTR(qemuDBusVMState) self = NULL;
g_autoptr(qemuDBusVMState) self = NULL;
if (VIR_ALLOC(self) < 0)
return NULL;

View File

@ -3648,7 +3648,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
for (i = 0; i < n; i++) {
g_autofree char *alias = virXMLPropString(nodes[i], "alias");
g_autofree char *pid = virXMLPropString(nodes[i], "pid");
VIR_AUTOPTR(qemuSlirp) slirp = qemuSlirpNew();
g_autoptr(qemuSlirp) slirp = qemuSlirpNew();
virDomainDeviceDef dev;
if (!alias || !pid || !slirp ||

View File

@ -14487,7 +14487,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom,
virDomainObjPtr vm;
qemuDomainObjPrivatePtr priv;
bool postcopy = !!(flags & VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY);
VIR_AUTOPTR(qemuMigrationParams) migParams = NULL;
g_autoptr(qemuMigrationParams) migParams = NULL;
unsigned long long max;
int ret = -1;
@ -14565,7 +14565,7 @@ qemuDomainMigrationGetPostcopyBandwidth(virQEMUDriverPtr driver,
virDomainObjPtr vm,
unsigned long *bandwidth)
{
VIR_AUTOPTR(qemuMigrationParams) migParams = NULL;
g_autoptr(qemuMigrationParams) migParams = NULL;
unsigned long long bw;
int rc;
int ret = -1;
@ -15687,7 +15687,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOPTR(virJSONValue) actions = NULL;
g_autoptr(virJSONValue) actions = NULL;
int rc;
int ret = -1;
size_t i;
@ -18223,8 +18223,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
VIR_AUTOUNREF(virStorageSourcePtr) mirror = mirrorsrc;
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
bool mirror_initialized = false;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) crdata = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceChainData) crdata = NULL;
virStorageSourcePtr n;
virStorageSourcePtr mirrorBacking = NULL;
int rc = 0;
@ -21586,7 +21586,7 @@ qemuDomainGetStats(virConnectPtr conn,
unsigned int flags)
{
g_autofree virDomainStatsRecordPtr tmp = NULL;
VIR_AUTOPTR(virTypedParamList) params = NULL;
g_autoptr(virTypedParamList) params = NULL;
size_t i;
if (VIR_ALLOC(params) < 0)

View File

@ -289,7 +289,7 @@ qemuFirmwareInterfaceParse(const char *path,
qemuFirmwarePtr fw)
{
virJSONValuePtr interfacesJSON;
VIR_AUTOPTR(qemuFirmwareOSInterface) interfaces = NULL;
g_autoptr(qemuFirmwareOSInterface) interfaces = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
size_t ninterfaces;
size_t i;
@ -509,7 +509,7 @@ qemuFirmwareTargetParse(const char *path,
for (i = 0; i < ntargets; i++) {
virJSONValuePtr item = virJSONValueArrayGet(targetsJSON, i);
virJSONValuePtr machines;
VIR_AUTOPTR(qemuFirmwareTarget) t = NULL;
g_autoptr(qemuFirmwareTarget) t = NULL;
const char *architectureStr = NULL;
size_t nmachines;
size_t j;
@ -575,7 +575,7 @@ qemuFirmwareFeatureParse(const char *path,
qemuFirmwarePtr fw)
{
virJSONValuePtr featuresJSON;
VIR_AUTOPTR(qemuFirmwareFeature) features = NULL;
g_autoptr(qemuFirmwareFeature) features = NULL;
size_t nfeatures;
size_t i;
@ -619,8 +619,8 @@ qemuFirmwarePtr
qemuFirmwareParse(const char *path)
{
g_autofree char *cont = NULL;
VIR_AUTOPTR(virJSONValue) doc = NULL;
VIR_AUTOPTR(qemuFirmware) fw = NULL;
g_autoptr(virJSONValue) doc = NULL;
g_autoptr(qemuFirmware) fw = NULL;
qemuFirmwarePtr ret = NULL;
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
@ -657,7 +657,7 @@ static int
qemuFirmwareInterfaceFormat(virJSONValuePtr doc,
qemuFirmwarePtr fw)
{
VIR_AUTOPTR(virJSONValue) interfacesJSON = NULL;
g_autoptr(virJSONValue) interfacesJSON = NULL;
size_t i;
if (!(interfacesJSON = virJSONValueNewArray()))
@ -682,7 +682,7 @@ qemuFirmwareInterfaceFormat(virJSONValuePtr doc,
static virJSONValuePtr
qemuFirmwareFlashFileFormat(qemuFirmwareFlashFile flash)
{
VIR_AUTOPTR(virJSONValue) json = NULL;
g_autoptr(virJSONValue) json = NULL;
virJSONValuePtr ret;
if (!(json = virJSONValueNewObject()))
@ -707,8 +707,8 @@ static int
qemuFirmwareMappingFlashFormat(virJSONValuePtr mapping,
qemuFirmwareMappingFlashPtr flash)
{
VIR_AUTOPTR(virJSONValue) executable = NULL;
VIR_AUTOPTR(virJSONValue) nvram_template = NULL;
g_autoptr(virJSONValue) executable = NULL;
g_autoptr(virJSONValue) nvram_template = NULL;
if (!(executable = qemuFirmwareFlashFileFormat(flash->executable)))
return -1;
@ -764,7 +764,7 @@ static int
qemuFirmwareMappingFormat(virJSONValuePtr doc,
qemuFirmwarePtr fw)
{
VIR_AUTOPTR(virJSONValue) mapping = NULL;
g_autoptr(virJSONValue) mapping = NULL;
if (!(mapping = virJSONValueNewObject()))
return -1;
@ -805,7 +805,7 @@ static int
qemuFirmwareTargetFormat(virJSONValuePtr doc,
qemuFirmwarePtr fw)
{
VIR_AUTOPTR(virJSONValue) targetsJSON = NULL;
g_autoptr(virJSONValue) targetsJSON = NULL;
size_t i;
if (!(targetsJSON = virJSONValueNewArray()))
@ -813,8 +813,8 @@ qemuFirmwareTargetFormat(virJSONValuePtr doc,
for (i = 0; i < fw->ntargets; i++) {
qemuFirmwareTargetPtr t = fw->targets[i];
VIR_AUTOPTR(virJSONValue) target = NULL;
VIR_AUTOPTR(virJSONValue) machines = NULL;
g_autoptr(virJSONValue) target = NULL;
g_autoptr(virJSONValue) machines = NULL;
size_t j;
if (!(target = virJSONValueNewObject()))
@ -857,7 +857,7 @@ static int
qemuFirmwareFeatureFormat(virJSONValuePtr doc,
qemuFirmwarePtr fw)
{
VIR_AUTOPTR(virJSONValue) featuresJSON = NULL;
g_autoptr(virJSONValue) featuresJSON = NULL;
size_t i;
if (!(featuresJSON = virJSONValueNewArray()))
@ -882,7 +882,7 @@ qemuFirmwareFeatureFormat(virJSONValuePtr doc,
char *
qemuFirmwareFormat(qemuFirmwarePtr fw)
{
VIR_AUTOPTR(virJSONValue) doc = NULL;
g_autoptr(virJSONValue) doc = NULL;
if (!fw)
return NULL;
@ -1391,7 +1391,7 @@ qemuFirmwareGetSupported(const char *machine,
}
if (fws && fwpath) {
VIR_AUTOPTR(virFirmware) tmp = NULL;
g_autoptr(virFirmware) tmp = NULL;
/* Append only unique pairs. */
for (j = 0; j < *nfws; j++) {

View File

@ -422,7 +422,7 @@ qemuDomainAttachDBusVMState(virQEMUDriverPtr driver,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_AUTOPTR(virJSONValue) props = NULL;
g_autoptr(virJSONValue) props = NULL;
int ret;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DBUS_VMSTATE)) {
@ -505,8 +505,8 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
VIR_AUTOPTR(qemuBlockStorageSourceChainData) newbackend = NULL;
VIR_AUTOPTR(qemuBlockStorageSourceChainData) oldbackend = NULL;
g_autoptr(qemuBlockStorageSourceChainData) newbackend = NULL;
g_autoptr(qemuBlockStorageSourceChainData) oldbackend = NULL;
g_autofree char *nodename = NULL;
int rc;
@ -672,12 +672,12 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
g_autoptr(qemuBlockStorageSourceChainData) data = NULL;
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autofree char *devstr = NULL;
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
VIR_AUTOPTR(virJSONValue) corProps = NULL;
g_autoptr(virJSONValue) corProps = NULL;
g_autofree char *corAlias = NULL;
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
@ -4232,7 +4232,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk)
{
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
VIR_AUTOPTR(qemuBlockStorageSourceChainData) diskBackend = NULL;
g_autoptr(qemuBlockStorageSourceChainData) diskBackend = NULL;
virDomainDeviceDef dev;
size_t i;
qemuDomainObjPrivatePtr priv = vm->privateData;

View File

@ -644,7 +644,7 @@ qemuInterfacePrepareSlirp(virQEMUDriverPtr driver,
virDomainNetDefPtr net)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
VIR_AUTOPTR(qemuSlirp) slirp = NULL;
g_autoptr(qemuSlirp) slirp = NULL;
size_t i;
if (!(slirp = qemuSlirpNewForHelper(cfg->slirpHelperName)))

View File

@ -99,7 +99,7 @@ qemuInteropFetchConfigs(const char *name,
char ***configs,
bool privileged)
{
VIR_AUTOPTR(virHashTable) files = NULL;
g_autoptr(virHashTable) files = NULL;
g_autofree char *homeConfig = NULL;
g_autofree char *xdgConfig = NULL;
g_autofree char *sysLocation = virFileBuildPath(QEMU_SYSTEM_LOCATION, name, NULL);

View File

@ -794,7 +794,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
unsigned int mirror_shallow,
const char *tlsAlias)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
int mon_ret = 0;
VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL;

View File

@ -2679,7 +2679,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon,
int nstats = 0;
int rc;
size_t i;
VIR_AUTOPTR(virJSONValue) devices = NULL;
g_autoptr(virJSONValue) devices = NULL;
if (!(devices = qemuMonitorJSONQueryBlockstats(mon)))
return -1;
@ -4347,8 +4347,8 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
bool shallow,
bool reuse)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
cmd = qemuMonitorJSONMakeCommand("drive-mirror",
"s:device", device,
@ -4381,8 +4381,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
unsigned long long buf_size,
bool shallow)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT;
virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT;
@ -5023,8 +5023,8 @@ int
qemuMonitorJSONJobDismiss(qemuMonitorPtr mon,
const char *jobname)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("job-dismiss",
"s:id", jobname,
@ -5046,8 +5046,8 @@ qemuMonitorJSONJobCancel(qemuMonitorPtr mon,
const char *jobname,
bool quiet)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("job-cancel",
"s:id", jobname,
@ -5073,8 +5073,8 @@ int
qemuMonitorJSONJobComplete(qemuMonitorPtr mon,
const char *jobname)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("job-complete",
"s:id", jobname,
@ -5808,9 +5808,9 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitorPtr mon,
bool fail_no_props,
qemuMonitorCPUModelInfoPtr *model_info)
{
VIR_AUTOPTR(virJSONValue) model = NULL;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) model = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data;
virJSONValuePtr cpu_model;
virJSONValuePtr cpu_props = NULL;
@ -5883,10 +5883,10 @@ qemuMonitorJSONGetCPUModelBaseline(qemuMonitorPtr mon,
virCPUDefPtr cpu_b,
qemuMonitorCPUModelInfoPtr *baseline)
{
VIR_AUTOPTR(virJSONValue) model_a = NULL;
VIR_AUTOPTR(virJSONValue) model_b = NULL;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) model_a = NULL;
g_autoptr(virJSONValue) model_b = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValuePtr data;
virJSONValuePtr cpu_model;
virJSONValuePtr cpu_props = NULL;
@ -5925,10 +5925,10 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitorPtr mon,
virCPUDefPtr cpu_b,
char **result)
{
VIR_AUTOPTR(virJSONValue) model_a = NULL;
VIR_AUTOPTR(virJSONValue) model_b = NULL;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) model_a = NULL;
g_autoptr(virJSONValue) model_b = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
const char *data_result;
virJSONValuePtr data;
@ -6468,8 +6468,8 @@ qemuMonitorJSONGetStringListProperty(qemuMonitorPtr mon,
const char *property,
char ***strList)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
VIR_AUTOSTRINGLIST list = NULL;
virJSONValuePtr data;
size_t n;
@ -6959,7 +6959,7 @@ qemuMonitorJSONGetSEVCapabilities(qemuMonitorPtr mon,
const char *cert_chain = NULL;
unsigned int cbitpos;
unsigned int reduced_phys_bits;
VIR_AUTOPTR(virSEVCapability) capability = NULL;
g_autoptr(virSEVCapability) capability = NULL;
*capabilities = NULL;
@ -7750,8 +7750,8 @@ static int
qemuMonitorJSONGetCPUProperties(qemuMonitorPtr mon,
char ***props)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
*props = NULL;
@ -8699,8 +8699,8 @@ qemuMonitorJSONBlockdevCreate(qemuMonitorPtr mon,
const char *jobname,
virJSONValuePtr props)
{
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
cmd = qemuMonitorJSONMakeCommand("blockdev-create",
"s:job-id", jobname,
@ -9292,7 +9292,7 @@ qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
const char *status = virJSONValueObjectGetString(data, "status");
const char *errmsg = virJSONValueObjectGetString(data, "error");
int tmp;
VIR_AUTOPTR(qemuMonitorJobInfo) job = NULL;
g_autoptr(qemuMonitorJobInfo) job = NULL;
qemuMonitorJobInfoPtr ret = NULL;
if (VIR_ALLOC(job) < 0)
@ -9323,8 +9323,8 @@ qemuMonitorJSONGetJobInfo(qemuMonitorPtr mon,
size_t *njobs)
{
virJSONValuePtr data;
VIR_AUTOPTR(virJSONValue) cmd = NULL;
VIR_AUTOPTR(virJSONValue) reply = NULL;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
size_t i;
if (!(cmd = qemuMonitorJSONMakeCommand("query-jobs", NULL)))

View File

@ -2517,7 +2517,7 @@ qemuProcessGetAllCpuAffinity(virBitmapPtr *cpumapRet)
static int
qemuProcessInitCpuAffinity(virDomainObjPtr vm)
{
VIR_AUTOPTR(virBitmap) cpumapToSet = NULL;
g_autoptr(virBitmap) cpumapToSet = NULL;
virDomainNumatuneMemMode mem_mode;
qemuDomainObjPrivatePtr priv = vm->privateData;
@ -2644,7 +2644,7 @@ qemuProcessSetupPid(virDomainObjPtr vm,
virDomainNumatuneMemMode mem_mode;
virCgroupPtr cgroup = NULL;
virBitmapPtr use_cpumask = NULL;
VIR_AUTOPTR(virBitmap) hostcpumap = NULL;
g_autoptr(virBitmap) hostcpumap = NULL;
char *mem_mask = NULL;
int ret = -1;

View File

@ -501,8 +501,8 @@ virQEMUQAPISchemaEntryProcess(size_t pos G_GNUC_UNUSED,
virHashTablePtr
virQEMUQAPISchemaConvert(virJSONValuePtr schemareply)
{
VIR_AUTOPTR(virHashTable) schema = NULL;
VIR_AUTOPTR(virJSONValue) schemajson = schemareply;
g_autoptr(virHashTable) schema = NULL;
g_autoptr(virJSONValue) schemajson = schemareply;
if (!(schema = virHashCreate(512, virJSONValueHashFree)))
return NULL;

View File

@ -81,7 +81,7 @@ qemuSlirpHasFeature(const qemuSlirp *slirp,
qemuSlirpPtr
qemuSlirpNew(void)
{
VIR_AUTOPTR(qemuSlirp) slirp = NULL;
g_autoptr(qemuSlirp) slirp = NULL;
if (VIR_ALLOC(slirp) < 0 ||
!(slirp->features = virBitmapNew(QEMU_SLIRP_FEATURE_LAST)))
@ -97,10 +97,10 @@ qemuSlirpNew(void)
qemuSlirpPtr
qemuSlirpNewForHelper(const char *helper)
{
VIR_AUTOPTR(qemuSlirp) slirp = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(qemuSlirp) slirp = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *output = NULL;
VIR_AUTOPTR(virJSONValue) doc = NULL;
g_autoptr(virJSONValue) doc = NULL;
virJSONValuePtr featuresJSON;
size_t i, nfeatures;
@ -297,7 +297,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
bool incoming)
{
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *pidfile = NULL;
g_autofree char *dbus_path = NULL;
g_autofree char *dbus_addr = NULL;

View File

@ -183,8 +183,8 @@ qemuVhostUserPtr
qemuVhostUserParse(const char *path)
{
g_autofree char *cont = NULL;
VIR_AUTOPTR(virJSONValue) doc = NULL;
VIR_AUTOPTR(qemuVhostUser) vu = NULL;
g_autoptr(virJSONValue) doc = NULL;
g_autoptr(qemuVhostUser) vu = NULL;
qemuVhostUserPtr ret = NULL;
if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
@ -214,7 +214,7 @@ qemuVhostUserParse(const char *path)
char *
qemuVhostUserFormat(qemuVhostUserPtr vu)
{
VIR_AUTOPTR(virJSONValue) doc = NULL;
g_autoptr(virJSONValue) doc = NULL;
if (!vu)
return NULL;
@ -285,7 +285,7 @@ qemuVhostUserGPUFillCapabilities(qemuVhostUserPtr vu,
virJSONValuePtr featuresJSON;
size_t nfeatures;
size_t i;
VIR_AUTOPTR(qemuVhostUserGPUFeature) features = NULL;
g_autoptr(qemuVhostUserGPUFeature) features = NULL;
if (!(featuresJSON = virJSONValueObjectGetArray(doc, "features"))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -350,9 +350,9 @@ qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
goto end;
for (i = 0; i < nvus; i++) {
VIR_AUTOPTR(virJSONValue) doc = NULL;
g_autoptr(virJSONValue) doc = NULL;
g_autofree char *output = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
vu = vus[i];
if (vu->type != QEMU_VHOST_USER_TYPE_GPU)

View File

@ -108,7 +108,7 @@ int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *shortname = NULL;
g_autofree char *pidfile = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int pair[2] = { -1, -1 };
int cmdret = 0, rc;
int exitstatus = 0;

View File

@ -400,7 +400,7 @@ daemonSetupNetworking(virNetServerPtr srv,
int unix_sock_rw_mask = 0;
int unix_sock_adm_mask = 0;
int ret = -1;
VIR_AUTOPTR(virSystemdActivation) act = NULL;
g_autoptr(virSystemdActivation) act = NULL;
virSystemdActivationMap actmap[] = {
{ .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
{ .name = DAEMON_NAME "-ro.socket", .family = AF_UNIX, .path = sock_path_ro },

View File

@ -401,7 +401,7 @@ daemonConfigLoadFile(struct daemonConfig *data,
const char *filename,
bool allow_missing)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
if (allow_missing &&
access(filename, R_OK) == -1 &&
@ -419,7 +419,7 @@ int daemonConfigLoadData(struct daemonConfig *data,
const char *filename,
const char *filedata)
{
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
conf = virConfReadString(filedata, 0);
if (!conf)

View File

@ -637,7 +637,7 @@ virSecuritySELinuxGenNewContext(const char *basecontext,
static int
virSecuritySELinuxLXCInitialize(virSecurityManagerPtr mgr)
{
VIR_AUTOPTR(virConf) selinux_conf = NULL;
g_autoptr(virConf) selinux_conf = NULL;
virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr);
data->skipAllLabel = true;

View File

@ -170,7 +170,7 @@ parserCommand(const char *profile_name, const char cmd)
const char * const argv[] = {
"/sbin/apparmor_parser", flag, profile, NULL
};
VIR_AUTOPTR(virCommand) command = virCommandNewArgs(argv);
g_autoptr(virCommand) command = virCommandNewArgs(argv);
virCommandRawStatus(command);
if ((ret = virCommandRun(command, &status)) != 0 ||

View File

@ -360,7 +360,7 @@ virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
.vol = vol,
};
g_autofree char *parthelper_path = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (!(parthelper_path = virFileFindResource("libvirt_parthelper",
abs_top_builddir "/src",
@ -414,7 +414,7 @@ virStorageBackendDiskReadGeometry(virStoragePoolObjPtr pool)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
g_autofree char *parthelper_path = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (!(parthelper_path = virFileFindResource("libvirt_parthelper",
abs_top_builddir "/src",
@ -492,7 +492,7 @@ virStorageBackendDiskBuildPool(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int format = def->source.format;
const char *fmt;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int ret = -1;
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
@ -774,7 +774,7 @@ virStorageBackendDiskDeleteVol(virStoragePoolObjPtr pool,
char *srcname = last_component(src_path);
bool isDevMapperDevice;
g_autofree char *devpath = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);
@ -856,7 +856,7 @@ virStorageBackendDiskCreateVol(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
virErrorPtr save_err;
g_autofree char *partFormat = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(PARTED,
def->source.devices[0].path,

View File

@ -109,7 +109,7 @@ virStorageBackendFileSystemNetFindNFSPoolSources(virNetfsDiscoverState *state)
1
};
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(SHOWMOUNT,
"--no-headers",
@ -139,7 +139,7 @@ virStorageBackendFileSystemNetFindPoolSources(const char *srcSpec,
size_t i;
int retNFS = -1;
int retGluster = 0;
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
g_autoptr(virStoragePoolSource) source = NULL;
virCheckFlags(0, NULL);
@ -299,7 +299,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool)
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int rc;
g_autofree char *src = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (virStorageBackendFileSystemIsValid(pool) < 0)
return -1;
@ -365,7 +365,7 @@ virStorageBackendFileSystemStop(virStoragePoolObjPtr pool)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int rc;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (virStorageBackendFileSystemIsValid(pool) < 0)
return -1;
@ -413,7 +413,7 @@ static int
virStorageBackendExecuteMKFS(const char *device,
const char *format)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(MKFS, "-t", format, NULL);

View File

@ -238,7 +238,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
glfs_fd_t *fd = NULL;
ssize_t len;
int backingFormat;
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
VIR_AUTOUNREF(virStorageSourcePtr) meta = NULL;
g_autofree char *header = NULL;
@ -478,7 +478,7 @@ virStorageBackendGlusterFindPoolSources(const char *srcSpec,
char *ret = NULL;
int rc;
size_t i;
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
g_autoptr(virStoragePoolSource) source = NULL;
virCheckFlags(0, NULL);

View File

@ -161,7 +161,7 @@ virStorageBackendISCSIFindPoolSources(const char *srcSpec,
.sources = NULL
};
g_autofree char *portal = NULL;
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
g_autoptr(virStoragePoolSource) source = NULL;
virCheckFlags(0, NULL);

View File

@ -307,7 +307,7 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
uint32_t block_size;
uint64_t nb_block;
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
if (virISCSIDirectTestUnitReady(iscsi, lun) < 0)
return -1;
@ -491,7 +491,7 @@ virStorageBackendISCSIDirectFindPoolSources(const char *srcSpec,
.sources = NULL
};
g_autofree char *portal = NULL;
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
g_autoptr(virStoragePoolSource) source = NULL;
virCheckFlags(0, NULL);

View File

@ -49,7 +49,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
bool on)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int ret;
cmd = virStorageBackendLogicalChangeCmd(VGCHANGE, def, on);
@ -71,7 +71,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
static void
virStorageBackendLogicalRemoveDevice(const char *path)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(PVREMOVE, path, NULL);
if (virCommandRun(cmd, NULL) < 0)
@ -89,7 +89,7 @@ virStorageBackendLogicalRemoveDevice(const char *path)
static int
virStorageBackendLogicalInitializeDevice(const char *path)
{
VIR_AUTOPTR(virCommand) pvcmd = NULL;
g_autoptr(virCommand) pvcmd = NULL;
/*
* LVM requires that the first sector is blanked if using
@ -421,7 +421,7 @@ virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
.pool = pool,
.vol = vol,
};
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(LVS,
"--separator", "#",
@ -520,7 +520,7 @@ virStorageBackendLogicalGetPoolSources(virStoragePoolSourceListPtr sourceList)
int vars[] = {
2
};
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
/*
* NOTE: ignoring errors here; this is just to "touch" any logical volumes
@ -702,7 +702,7 @@ virStorageBackendLogicalBuildPool(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int ret = -1;
size_t i = 0;
VIR_AUTOPTR(virCommand) vgcmd = NULL;
g_autoptr(virCommand) vgcmd = NULL;
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
@ -765,7 +765,7 @@ virStorageBackendLogicalRefreshPool(virStoragePoolObjPtr pool)
2
};
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virWaitForDevices();
@ -817,7 +817,7 @@ virStorageBackendLogicalDeletePool(virStoragePoolObjPtr pool,
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
size_t i;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);
@ -841,8 +841,8 @@ virStorageBackendLogicalDeleteVol(virStoragePoolObjPtr pool G_GNUC_UNUSED,
virStorageVolDefPtr vol,
unsigned int flags)
{
VIR_AUTOPTR(virCommand) lvchange_cmd = NULL;
VIR_AUTOPTR(virCommand) lvremove_cmd = NULL;
g_autoptr(virCommand) lvchange_cmd = NULL;
g_autoptr(virCommand) lvremove_cmd = NULL;
virCheckFlags(0, -1);
@ -869,7 +869,7 @@ virStorageBackendLogicalLVCreate(virStorageVolDefPtr vol,
virStoragePoolDefPtr def)
{
unsigned long long capacity = vol->target.capacity;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (vol->target.encryption &&
vol->target.encryption->format != VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {

View File

@ -46,7 +46,7 @@ virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
const char *dev)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
if (VIR_ALLOC(vol) < 0)
return -1;

View File

@ -720,7 +720,7 @@ virStorageBackendRBDRefreshPool(virStoragePoolObjPtr pool)
goto cleanup;
for (i = 0; names[i] != NULL; i++) {
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
if (VIR_ALLOC(vol) < 0)
goto cleanup;

View File

@ -110,7 +110,7 @@ virStorageBackendSheepdogAddHostArg(virCommandPtr cmd,
static int
virStorageBackendSheepdogAddVolume(virStoragePoolObjPtr pool, const char *diskInfo)
{
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
if (diskInfo == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@ -140,7 +140,7 @@ virStorageBackendSheepdogRefreshAllVol(virStoragePoolObjPtr pool)
g_autofree char *output = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOSTRINGLIST cells = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
@ -177,7 +177,7 @@ static int
virStorageBackendSheepdogRefreshPool(virStoragePoolObjPtr pool)
{
g_autofree char *output = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(SHEEPDOGCLI, "node", "info", "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
@ -198,7 +198,7 @@ virStorageBackendSheepdogDeleteVol(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
unsigned int flags)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);
@ -241,7 +241,7 @@ virStorageBackendSheepdogBuildVol(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
unsigned int flags)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);
@ -325,7 +325,7 @@ virStorageBackendSheepdogRefreshVol(virStoragePoolObjPtr pool,
{
char *output = NULL;
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-r", NULL);
virStorageBackendSheepdogAddHostArg(cmd, pool);
@ -355,7 +355,7 @@ virStorageBackendSheepdogResizeVol(virStoragePoolObjPtr pool,
unsigned long long capacity,
unsigned int flags)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);

View File

@ -41,7 +41,7 @@ virStorageBackendVzPoolStart(virStoragePoolObjPtr pool)
g_autofree char *grp_name = NULL;
g_autofree char *usr_name = NULL;
g_autofree char *mode = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int ret;
/* Check the permissions */
@ -122,7 +122,7 @@ virStorageBackendVzPoolStop(virStoragePoolObjPtr pool)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int rc;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
/* Short-circuit if already unmounted */
if ((rc = virStorageBackendVzIsMounted(pool)) != 1)

View File

@ -53,7 +53,7 @@ virStorageBackendZFSVolModeNeeded(void)
{
int ret = -1, exit_code = -1;
g_autofree char *error = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
/* 'zfs get' without arguments prints out
* usage information to stderr, including
@ -178,7 +178,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
size_t i;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *volumes_list = NULL;
/**
@ -223,7 +223,7 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool G_GNUC_UNUSED)
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
char *zpool_props = NULL;
size_t i;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOSTRINGLIST tokens = NULL;
@ -297,7 +297,7 @@ virStorageBackendZFSCreateVol(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int ret = -1;
int volmode_needed = -1;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@ -366,7 +366,7 @@ virStorageBackendZFSDeleteVol(virStoragePoolObjPtr pool,
unsigned int flags)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virCommand) destroy_cmd = NULL;
g_autoptr(virCommand) destroy_cmd = NULL;
virCheckFlags(0, -1);
@ -384,7 +384,7 @@ virStorageBackendZFSBuildPool(virStoragePoolObjPtr pool,
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
size_t i;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int ret = -1;
virCheckFlags(0, -1);
@ -413,7 +413,7 @@ virStorageBackendZFSDeletePool(virStoragePoolObjPtr pool,
unsigned int flags)
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
virCheckFlags(0, -1);

View File

@ -738,7 +738,7 @@ storagePoolCreateXML(virConnectPtr conn,
virStorageBackendPtr backend;
virObjectEventPtr event = NULL;
unsigned int build_flags = 0;
VIR_AUTOPTR(virStoragePoolDef) newDef = NULL;
g_autoptr(virStoragePoolDef) newDef = NULL;
g_autofree char *stateFile = NULL;
virCheckFlags(VIR_STORAGE_POOL_CREATE_WITH_BUILD |
@ -825,7 +825,7 @@ storagePoolDefineXML(virConnectPtr conn,
virStoragePoolDefPtr def;
virStoragePoolPtr pool = NULL;
virObjectEventPtr event = NULL;
VIR_AUTOPTR(virStoragePoolDef) newDef = NULL;
g_autoptr(virStoragePoolDef) newDef = NULL;
virCheckFlags(0, NULL);
@ -1908,7 +1908,7 @@ storageVolCreateXML(virStoragePoolPtr pool,
virStoragePoolDefPtr def;
virStorageBackendPtr backend;
virStorageVolPtr vol = NULL, newvol = NULL;
VIR_AUTOPTR(virStorageVolDef) voldef = NULL;
g_autoptr(virStorageVolDef) voldef = NULL;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, NULL);
@ -2047,7 +2047,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr pool,
virStorageVolPtr newvol = NULL;
virStorageVolPtr vol = NULL;
int buildret;
VIR_AUTOPTR(virStorageVolDef) voldef = NULL;
g_autoptr(virStorageVolDef) voldef = NULL;
virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA |
VIR_STORAGE_VOL_CREATE_REFLINK,
@ -2295,7 +2295,7 @@ virStorageVolPoolRefreshDataFree(void *opaque)
static int
virStorageBackendPloopRestoreDesc(char *path)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *refresh_tool = NULL;
g_autofree char *desc = NULL;

View File

@ -598,7 +598,7 @@ storageBackendCreatePloop(virStoragePoolObjPtr pool G_GNUC_UNUSED,
{
int ret = -1;
bool created = false;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *create_tool = NULL;
virCheckFlags(0, -1);
@ -667,7 +667,7 @@ static int
storagePloopResize(virStorageVolDefPtr vol,
unsigned long long capacity)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *resize_tool = NULL;
resize_tool = virFindFileInPath("ploop");
@ -1285,7 +1285,7 @@ storageBackendDoCreateQemuImg(virStoragePoolObjPtr pool,
const char *inputSecretPath,
virStorageVolEncryptConvertStep convertStep)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virStorageBackendCreateQemuImgCmdFromVol(pool, vol, inputvol,
flags, create_tool,
@ -2261,7 +2261,7 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool,
int ret = -1;
const char *type;
virStorageEncryptionPtr enc = vol->target.encryption;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *img_tool = NULL;
g_autofree char *secretPath = NULL;
g_autofree char *secretAlias = NULL;
@ -2381,7 +2381,7 @@ static int
storageBackendPloopHasSnapshots(char *path)
{
char *snap_tool = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *output = NULL;
snap_tool = virFindFileInPath("ploop");
@ -2595,7 +2595,7 @@ storageBackendVolWipeLocalFile(const char *path,
const char *alg_char = NULL;
struct stat st;
VIR_AUTOCLOSE fd = -1;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
fd = open(path, O_RDWR);
if (fd == -1) {
@ -2672,7 +2672,7 @@ static int
storageBackendVolWipePloop(virStorageVolDefPtr vol,
unsigned int algorithm)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *target_path = NULL;
g_autofree char *disk_desc = NULL;
g_autofree char *create_tool = NULL;
@ -2913,7 +2913,7 @@ virStorageBackendFindGlusterPoolSources(const char *host,
bool report)
{
int rc;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *glusterpath = NULL;
g_autofree char *outbuf = NULL;
@ -3181,7 +3181,7 @@ virStorageBackendPARTEDFindLabel(const char *device,
};
char *start, *end;
int ret = VIR_STORAGE_PARTED_ERROR;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *output = NULL;
g_autofree char *error = NULL;
@ -3527,7 +3527,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool)
struct stat statbuf;
int direrr;
int ret = -1;
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
VIR_AUTOCLOSE fd = -1;
VIR_AUTOUNREF(virStorageSourcePtr) target = NULL;
@ -3666,7 +3666,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
int retval = -1;
VIR_AUTOPTR(virStorageVolDef) vol = NULL;
g_autoptr(virStorageVolDef) vol = NULL;
g_autofree char *devpath = NULL;
/* Check if the pool is using a stable target path. The call to

View File

@ -1075,7 +1075,7 @@ testOpenVolumesForPool(const char *file,
int num;
g_autofree char *vol_xpath = NULL;
g_autofree xmlNodePtr *nodes = NULL;
VIR_AUTOPTR(virStorageVolDef) volDef = NULL;
g_autoptr(virStorageVolDef) volDef = NULL;
/* Find storage volumes */
if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", objidx) < 0)
@ -6347,7 +6347,7 @@ testConnectFindStoragePoolSources(virConnectPtr conn G_GNUC_UNUSED,
{
int pool_type;
char *ret = NULL;
VIR_AUTOPTR(virStoragePoolSource) source = NULL;
g_autoptr(virStoragePoolSource) source = NULL;
virCheckFlags(0, NULL);
@ -6428,7 +6428,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
virStoragePoolDefPtr def;
virStoragePoolPtr pool = NULL;
virObjectEventPtr event = NULL;
VIR_AUTOPTR(virStoragePoolDef) newDef = NULL;
g_autoptr(virStoragePoolDef) newDef = NULL;
virCheckFlags(0, NULL);
@ -6491,7 +6491,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
virStoragePoolDefPtr def;
virStoragePoolPtr pool = NULL;
virObjectEventPtr event = NULL;
VIR_AUTOPTR(virStoragePoolDef) newDef = NULL;
g_autoptr(virStoragePoolDef) newDef = NULL;
virCheckFlags(0, NULL);
@ -6994,7 +6994,7 @@ testStorageVolCreateXML(virStoragePoolPtr pool,
virStoragePoolObjPtr obj;
virStoragePoolDefPtr def;
virStorageVolPtr ret = NULL;
VIR_AUTOPTR(virStorageVolDef) privvol = NULL;
g_autoptr(virStorageVolDef) privvol = NULL;
virCheckFlags(0, NULL);
@ -7054,7 +7054,7 @@ testStorageVolCreateXMLFrom(virStoragePoolPtr pool,
virStoragePoolDefPtr def;
virStorageVolDefPtr origvol = NULL;
virStorageVolPtr ret = NULL;
VIR_AUTOPTR(virStorageVolDef) privvol = NULL;
g_autoptr(virStorageVolDef) privvol = NULL;
virCheckFlags(0, NULL);

View File

@ -111,7 +111,7 @@ virAuthGetCredential(const char *servicename,
const char *path,
char **value)
{
VIR_AUTOPTR(virAuthConfig) config = NULL;
g_autoptr(virAuthConfig) config = NULL;
const char *tmp;
*value = NULL;

View File

@ -1199,7 +1199,7 @@ char *
virBitmapDataFormat(const void *data,
int len)
{
VIR_AUTOPTR(virBitmap) map = NULL;
g_autoptr(virBitmap) map = NULL;
if (!(map = virBitmapNewData(data, len)))
return NULL;

View File

@ -488,7 +488,7 @@ virCommandMassClose(virCommandPtr cmd,
int childout,
int childerr)
{
VIR_AUTOPTR(virBitmap) fds = NULL;
g_autoptr(virBitmap) fds = NULL;
int openmax = sysconf(_SC_OPEN_MAX);
int fd = -1;
@ -839,7 +839,7 @@ virExec(virCommandPtr cmd)
int
virRun(const char *const*argv, int *status)
{
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgs(argv);
g_autoptr(virCommand) cmd = virCommandNewArgs(argv);
return virCommandRun(cmd, status);
}
@ -3020,7 +3020,7 @@ virCommandFree(virCommandPtr cmd)
* This requests asynchronous string IO on @cmd. It is useful in
* combination with virCommandRunAsync():
*
* VIR_AUTOPTR(virCommand) cmd = virCommandNew*(...);
* g_autoptr(virCommand) cmd = virCommandNew*(...);
* g_autofree char *buf = NULL;
*
* ...

View File

@ -910,7 +910,7 @@ int virFileNBDDeviceAssociate(const char *file,
{
g_autofree char *nbddev = NULL;
g_autofree char *qemunbd = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
const char *fmtstr = NULL;
if (!virFileNBDLoadDriver())

View File

@ -113,7 +113,7 @@ virFirewallCheckUpdateLock(bool *lockflag,
const char *const*args)
{
int status; /* Ignore failed commands without logging them */
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgs(args);
g_autoptr(virCommand) cmd = virCommandNewArgs(args);
if (virCommandRun(cmd, &status) < 0 || status) {
VIR_INFO("locking not supported by %s", args[0]);
} else {
@ -666,7 +666,7 @@ virFirewallApplyRuleDirect(virFirewallRulePtr rule,
{
size_t i;
const char *bin = virFirewallLayerCommandTypeToString(rule->layer);
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int status;
g_autofree char *error = NULL;
@ -838,7 +838,7 @@ virFirewallApply(virFirewallPtr firewall)
if (virFirewallApplyGroup(firewall, i) < 0) {
VIR_DEBUG("Rolling back groups up to %zu for %p", i, firewall);
size_t first = i;
VIR_AUTOPTR(virError) saved_error = virSaveLastError();
g_autoptr(virError) saved_error = virSaveLastError();
/*
* Look at any inheritance markers to figure out

View File

@ -241,7 +241,7 @@ virHookCall(int driver,
{
int ret;
g_autofree char *path = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
const char *drvstr;
const char *opstr;
const char *subopstr;

View File

@ -229,7 +229,7 @@ static int
virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
virPCIDevicePtr *pci)
{
VIR_AUTOPTR(virPCIDevice) actual = NULL;
g_autoptr(virPCIDevice) actual = NULL;
const virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
*pci = NULL;
@ -272,7 +272,7 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
VIR_AUTOPTR(virPCIDevice) pci = NULL;
g_autoptr(virPCIDevice) pci = NULL;
if (virHostdevGetPCIHostDevice(hostdev, &pci) < 0)
return NULL;
@ -537,7 +537,7 @@ virHostdevRestoreNetConfig(virDomainHostdevDefPtr hostdev,
g_autofree char *linkdev = NULL;
g_autofree virMacAddrPtr MAC = NULL;
g_autofree virMacAddrPtr adminMAC = NULL;
VIR_AUTOPTR(virNetDevVlan) vlan = NULL;
g_autoptr(virNetDevVlan) vlan = NULL;
virNetDevVPortProfilePtr virtPort;
int vf = -1;
bool port_profile_associate = false;
@ -1111,7 +1111,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
for (i = 0; i < nhostdevs; i++) {
const virDomainHostdevDef *hostdev = hostdevs[i];
VIR_AUTOPTR(virPCIDevice) actual = NULL;
g_autoptr(virPCIDevice) actual = NULL;
if (virHostdevGetPCIHostDevice(hostdev, &actual) < 0)
goto cleanup;
@ -1156,7 +1156,7 @@ virHostdevUpdateActiveUSBDevices(virHostdevManagerPtr mgr,
virObjectLock(mgr->activeUSBHostdevs);
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevSubsysUSBPtr usbsrc;
VIR_AUTOPTR(virUSBDevice) usb = NULL;
g_autoptr(virUSBDevice) usb = NULL;
hostdev = hostdevs[i];
usbsrc = &hostdev->source.subsys.u.usb;
@ -1191,7 +1191,7 @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevManagerPtr mgr,
const char *dom_name)
{
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
VIR_AUTOPTR(virSCSIDevice) scsi = NULL;
g_autoptr(virSCSIDevice) scsi = NULL;
virSCSIDevicePtr tmp = NULL;
if (!(scsi = virSCSIDeviceNew(NULL,
@ -1260,7 +1260,7 @@ virHostdevUpdateActiveMediatedDevices(virHostdevManagerPtr mgr,
{
int ret = -1;
size_t i;
VIR_AUTOPTR(virMediatedDevice) mdev = NULL;
g_autoptr(virMediatedDevice) mdev = NULL;
if (nhostdevs == 0)
return 0;
@ -1462,7 +1462,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr mgr,
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
bool required = true;
VIR_AUTOPTR(virUSBDevice) usb = NULL;
g_autoptr(virUSBDevice) usb = NULL;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
continue;
@ -1507,7 +1507,7 @@ virHostdevPrepareSCSIHostDevices(virDomainHostdevDefPtr hostdev,
virSCSIDeviceListPtr list)
{
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
VIR_AUTOPTR(virSCSIDevice) scsi = NULL;
g_autoptr(virSCSIDevice) scsi = NULL;
if (hostdev->managed) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@ -1651,7 +1651,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr mgr,
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &hostdev->source.subsys.u.scsi_host;
VIR_AUTOPTR(virSCSIVHostDevice) host = NULL;
g_autoptr(virSCSIVHostDevice) host = NULL;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST)
@ -1734,7 +1734,7 @@ virHostdevPrepareMediatedDevices(virHostdevManagerPtr mgr,
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysMediatedDevPtr src = &hostdev->source.subsys.u.mdev;
VIR_AUTOPTR(virMediatedDevice) mdev = NULL;
g_autoptr(virMediatedDevice) mdev = NULL;
if (!virHostdevIsMdevDevice(hostdev))
continue;
@ -1782,7 +1782,7 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr mgr,
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb;
VIR_AUTOPTR(virUSBDevice) usb = NULL;
g_autoptr(virUSBDevice) usb = NULL;
virUSBDevicePtr tmp;
const char *usedby_drvname;
const char *usedby_domname;
@ -1834,7 +1834,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr mgr,
const char *dom_name)
{
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
VIR_AUTOPTR(virSCSIDevice) scsi = NULL;
g_autoptr(virSCSIDevice) scsi = NULL;
virSCSIDevicePtr tmp;
if (!(scsi = virSCSIDeviceNew(NULL,
@ -1909,7 +1909,7 @@ virHostdevReAttachSCSIVHostDevices(virHostdevManagerPtr mgr,
virObjectLock(mgr->activeSCSIVHostHostdevs);
for (i = 0; i < nhostdevs; i++) {
VIR_AUTOPTR(virSCSIVHostDevice) host = NULL;
g_autoptr(virSCSIVHostDevice) host = NULL;
virSCSIVHostDevicePtr tmp;
virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &hostdev->source.subsys.u.scsi_host;
@ -1978,7 +1978,7 @@ virHostdevReAttachMediatedDevices(virHostdevManagerPtr mgr,
virObjectLock(mgr->activeMediatedHostdevs);
for (i = 0; i < nhostdevs; i++) {
VIR_AUTOPTR(virMediatedDevice) mdev = NULL;
g_autoptr(virMediatedDevice) mdev = NULL;
virMediatedDevicePtr tmp;
virDomainHostdevSubsysMediatedDevPtr mdevsrc;
virDomainHostdevDefPtr hostdev = hostdevs[i];

View File

@ -90,7 +90,7 @@ virISCSIGetSession(const char *devpath,
int exitstatus = 0;
g_autofree char *error = NULL;
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM, "--mode",
g_autoptr(virCommand) cmd = virCommandNewArgList(ISCSIADM, "--mode",
"session", NULL);
virCommandSetErrorBuffer(cmd, &error);
@ -125,7 +125,7 @@ virStorageBackendIQNFound(const char *initiatoriqn,
g_autofree char *outbuf = NULL;
g_autofree char *iface = NULL;
g_autofree char *iqn = NULL;
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM,
g_autoptr(virCommand) cmd = virCommandNewArgList(ISCSIADM,
"--mode", "iface", NULL);
*ifacename = NULL;
@ -210,7 +210,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn,
int exitstatus = -1;
g_autofree char *iface_name = NULL;
g_autofree char *temp_ifacename = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (virAsprintf(&temp_ifacename,
"libvirt-iface-%08llx",
@ -285,7 +285,7 @@ virISCSIConnection(const char *portal,
"--targetname", target,
NULL
};
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *ifacename = NULL;
cmd = virCommandNewArgs(baseargv);
@ -349,7 +349,7 @@ virISCSIConnectionLogout(const char *portal,
int
virISCSIRescanLUNs(const char *session)
{
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM,
g_autoptr(virCommand) cmd = virCommandNewArgList(ISCSIADM,
"--mode", "session",
"-r", session,
"-R",
@ -404,7 +404,7 @@ virISCSIScanTargetsInternal(const char *portal,
int vars[] = { 2 };
struct virISCSITargetList list;
size_t i;
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList(ISCSIADM,
g_autoptr(virCommand) cmd = virCommandNewArgList(ISCSIADM,
"--mode", "discovery",
"--type", "sendtargets",
"--portal", portal,
@ -519,7 +519,7 @@ int
virISCSINodeNew(const char *portal,
const char *target)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int status;
cmd = virCommandNewArgList(ISCSIADM,
@ -553,7 +553,7 @@ virISCSINodeUpdate(const char *portal,
const char *name,
const char *value)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int status;
cmd = virCommandNewArgList(ISCSIADM,

View File

@ -2050,7 +2050,7 @@ char *
virJSONStringReformat(const char *jsonstr,
bool pretty)
{
VIR_AUTOPTR(virJSONValue) json = NULL;
g_autoptr(virJSONValue) json = NULL;
if (!(json = virJSONValueFromString(jsonstr)))
return NULL;
@ -2144,7 +2144,7 @@ virJSONValueObjectDeflattenWorker(const char *key,
virJSONValuePtr
virJSONValueObjectDeflatten(virJSONValuePtr json)
{
VIR_AUTOPTR(virJSONValue) deflattened = NULL;
g_autoptr(virJSONValue) deflattened = NULL;
virJSONValuePtr ret = NULL;
if (!(deflattened = virJSONValueNewObject()))

View File

@ -28,7 +28,7 @@
static int
doModprobe(const char *opts, const char *module, char **outbuf, char **errbuf)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNew(MODPROBE);
if (opts)
@ -49,7 +49,7 @@ doModprobe(const char *opts, const char *module, char **outbuf, char **errbuf)
static int
doRmmod(const char *module, char **errbuf)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(RMMOD, module, NULL);
virCommandSetErrorBuffer(cmd, errbuf);

View File

@ -49,7 +49,7 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
char **server_duid)
{
g_autofree char *lease_entries = NULL;
VIR_AUTOPTR(virJSONValue) leases_array = NULL;
g_autoptr(virJSONValue) leases_array = NULL;
long long expirytime;
int custom_lease_file_len = 0;
virJSONValuePtr lease_tmp = NULL;
@ -212,7 +212,7 @@ virLeaseNew(virJSONValuePtr *lease_ret,
const char *iaid,
const char *server_duid)
{
VIR_AUTOPTR(virJSONValue) lease_new = NULL;
g_autoptr(virJSONValue) lease_new = NULL;
const char *exptime_tmp = getenv("DNSMASQ_LEASE_EXPIRES");
long long expirytime = 0;
g_autofree char *exptime = NULL;

View File

@ -141,7 +141,7 @@ virMediatedDevicePtr
virMediatedDeviceNew(const char *uuidstr, virMediatedDeviceModelType model)
{
virMediatedDevicePtr ret = NULL;
VIR_AUTOPTR(virMediatedDevice) dev = NULL;
g_autoptr(virMediatedDevice) dev = NULL;
g_autofree char *sysfspath = NULL;
if (!(sysfspath = virMediatedDeviceGetSysfsPath(uuidstr)))
@ -495,7 +495,7 @@ int
virMediatedDeviceTypeReadAttrs(const char *sysfspath,
virMediatedDeviceTypePtr *type)
{
VIR_AUTOPTR(virMediatedDeviceType) tmp = NULL;
g_autoptr(virMediatedDeviceType) tmp = NULL;
#define MDEV_GET_SYSFS_ATTR(attr, dst, cb, optional) \
do { \

View File

@ -2726,7 +2726,7 @@ static int virNetDevGetMcastList(const char *ifname,
char *buf = NULL;
char *next = NULL;
int ret = -1, len;
VIR_AUTOPTR(virNetDevMcastEntry) entry = NULL;
g_autoptr(virNetDevMcastEntry) entry = NULL;
mcast->entries = NULL;
mcast->nentries = 0;

View File

@ -952,7 +952,7 @@ virNetDevBridgeFDBAddDel(const virMacAddr *mac, const char *ifname,
struct nlmsgerr *err;
unsigned int recvbuflen;
struct ndmsg ndm = { .ndm_family = PF_BRIDGE, .ndm_state = NUD_NOARP };
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
g_autoptr(virNetlinkMsg) nl_msg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
if (virNetDevGetIndex(ifname, &ndm.ndm_ifindex) < 0)

View File

@ -166,8 +166,8 @@ virNetDevIPAddrAdd(const char *ifname,
unsigned int prefix)
{
unsigned int recvbuflen;
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
VIR_AUTOPTR(virSocketAddr) broadcast = NULL;
g_autoptr(virNetlinkMsg) nlmsg = NULL;
g_autoptr(virSocketAddr) broadcast = NULL;
g_autofree struct nlmsghdr *resp = NULL;
g_autofree char *ipStr = NULL;
g_autofree char *peerStr = NULL;
@ -239,7 +239,7 @@ virNetDevIPAddrDel(const char *ifname,
unsigned int prefix)
{
unsigned int recvbuflen;
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
g_autoptr(virNetlinkMsg) nlmsg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_DELADDR, ifname,
@ -289,7 +289,7 @@ virNetDevIPRouteAdd(const char *ifname,
int errCode;
virSocketAddr defaultAddr;
virSocketAddrPtr actualAddr;
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
g_autoptr(virNetlinkMsg) nlmsg = NULL;
g_autofree char *toStr = NULL;
g_autofree char *viaStr = NULL;
g_autofree struct nlmsghdr *resp = NULL;
@ -431,7 +431,7 @@ virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count)
unsigned int recvbuflen;
bool dad = true;
time_t max_time = time(NULL) + VIR_DAD_WAIT_TIMEOUT;
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
g_autoptr(virNetlinkMsg) nlmsg = NULL;
if (!(nlmsg = nlmsg_alloc_simple(RTM_GETADDR,
NLM_F_REQUEST | NLM_F_DUMP))) {
@ -620,7 +620,7 @@ virNetDevIPCheckIPv6Forwarding(void)
.devices = NULL,
.ndevices = 0
};
VIR_AUTOPTR(virNetlinkMsg) nlmsg = NULL;
g_autoptr(virNetlinkMsg) nlmsg = NULL;
/* Prepare the request message */
@ -688,7 +688,7 @@ virNetDevIPAddrAdd(const char *ifname,
unsigned int prefix)
{
virSocketAddr broadcast;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *addrstr = NULL;
g_autofree char *bcaststr = NULL;
g_autofree char *peerstr = NULL;
@ -743,7 +743,7 @@ virNetDevIPAddrDel(const char *ifname,
virSocketAddr *addr,
unsigned int prefix)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *addrstr = NULL;
if (!(addrstr = virSocketAddrFormat(addr)))
@ -778,7 +778,7 @@ virNetDevIPRouteAdd(const char *ifname,
virSocketAddrPtr gateway,
unsigned int metric)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *addrstr = NULL;
g_autofree char *gatewaystr = NULL;

View File

@ -1117,9 +1117,9 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
}
if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
VIR_AUTOPTR(virMacAddr) MAC = NULL;
VIR_AUTOPTR(virMacAddr) adminMAC = NULL;
VIR_AUTOPTR(virNetDevVlan) vlan = NULL;
g_autoptr(virMacAddr) MAC = NULL;
g_autoptr(virMacAddr) adminMAC = NULL;
g_autoptr(virNetDevVlan) vlan = NULL;
if ((virNetDevReadNetConfig(linkdev, -1, stateDir,
&adminMAC, &vlan, &MAC) == 0) &&

View File

@ -141,7 +141,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
char macaddrstr[VIR_MAC_STRING_BUFLEN];
char ifuuidstr[VIR_UUID_STRING_BUFLEN];
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *attachedmac_ex_id = NULL;
g_autofree char *ifaceid_ex_id = NULL;
g_autofree char *profile_ex_id = NULL;
@ -213,7 +213,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
*/
int virNetDevOpenvswitchRemovePort(const char *brname G_GNUC_UNUSED, const char *ifname)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNew(OVSVSCTL);
virNetDevOpenvswitchAddTimeout(cmd);
@ -240,7 +240,7 @@ int virNetDevOpenvswitchRemovePort(const char *brname G_GNUC_UNUSED, const char
int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
{
size_t len;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNew(OVSVSCTL);
virNetDevOpenvswitchAddTimeout(cmd);
@ -276,7 +276,7 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
*/
int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (!migrate) {
VIR_DEBUG("No OVS port data for interface %s", ifname);
@ -315,7 +315,7 @@ int
virNetDevOpenvswitchInterfaceParseStats(const char *json,
virDomainInterfaceStatsPtr stats)
{
VIR_AUTOPTR(virJSONValue) jsonStats = NULL;
g_autoptr(virJSONValue) jsonStats = NULL;
virJSONValuePtr jsonMap = NULL;
size_t i;
@ -386,7 +386,7 @@ int
virNetDevOpenvswitchInterfaceStats(const char *ifname,
virDomainInterfaceStatsPtr stats)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *output = NULL;
cmd = virCommandNew(OVSVSCTL);
@ -504,7 +504,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
size_t ntokens = 0;
int status;
int ret = -1;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
/* Openvswitch vhostuser path are hardcoded to
* /<runstatedir>/openvswitch/<ifname>
@ -550,7 +550,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNew(OVSVSCTL);
virNetDevOpenvswitchAddTimeout(cmd);

View File

@ -120,7 +120,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
for (i = 0; i < MAX_VETH_RETRIES; i++) {
g_autofree char *veth1auto = NULL;
g_autofree char *veth2auto = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int status;
if (!*veth1) {
@ -195,7 +195,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
int virNetDevVethDelete(const char *veth)
{
int status;
VIR_AUTOPTR(virCommand) cmd = virCommandNewArgList("ip", "link",
g_autoptr(virCommand) cmd = virCommandNewArgList("ip", "link",
"del", veth, NULL);
if (virCommandRun(cmd, &status) < 0)

View File

@ -297,7 +297,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg,
};
struct pollfd fds[1];
g_autofree struct nlmsghdr *temp_resp = NULL;
VIR_AUTOPTR(virNetlinkHandle) nlhandle = NULL;
g_autoptr(virNetlinkHandle) nlhandle = NULL;
int len = 0;
memset(fds, 0, sizeof(fds));
@ -338,7 +338,7 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg,
.nl_pid = dst_pid,
.nl_groups = 0,
};
VIR_AUTOPTR(virNetlinkHandle) nlhandle = NULL;
g_autoptr(virNetlinkHandle) nlhandle = NULL;
if (!(nlhandle = virNetlinkSendRequest(nl_msg, src_pid, nladdr,
protocol, groups)))
@ -396,7 +396,7 @@ virNetlinkDumpLink(const char *ifname, int ifindex,
.ifi_index = ifindex
};
unsigned int recvbuflen;
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
g_autoptr(virNetlinkMsg) nl_msg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
if (ifname && ifindex <= 0 && virNetDevGetIndex(ifname, &ifindex) < 0)
@ -507,7 +507,7 @@ virNetlinkNewLink(const char *ifname,
struct nlattr *infodata = NULL;
unsigned int buflen;
struct ifinfomsg ifinfo = { .ifi_family = AF_UNSPEC };
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
g_autoptr(virNetlinkMsg) nl_msg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
*error = 0;
@ -613,7 +613,7 @@ virNetlinkDelLink(const char *ifname, virNetlinkDelLinkFallback fallback)
struct nlmsgerr *err;
struct ifinfomsg ifinfo = { .ifi_family = AF_UNSPEC };
unsigned int recvbuflen;
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
g_autoptr(virNetlinkMsg) nl_msg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
nl_msg = nlmsg_alloc_simple(RTM_DELLINK,
@ -697,7 +697,7 @@ virNetlinkGetNeighbor(void **nlData, uint32_t src_pid, uint32_t dst_pid)
.ndm_family = AF_UNSPEC,
};
unsigned int recvbuflen;
VIR_AUTOPTR(virNetlinkMsg) nl_msg = NULL;
g_autoptr(virNetlinkMsg) nl_msg = NULL;
g_autofree struct nlmsghdr *resp = NULL;
nl_msg = nlmsg_alloc_simple(RTM_GETNEIGH, NLM_F_DUMP | NLM_F_REQUEST);

View File

@ -239,7 +239,7 @@ int virNodeSuspend(unsigned int target,
static int
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *binary = NULL;
int status;

View File

@ -57,7 +57,7 @@ char *
virNumaGetAutoPlacementAdvice(unsigned short vcpus,
unsigned long long balloon)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
char *output = NULL;
cmd = virCommandNewArgList(NUMAD, "-w", NULL);
@ -259,7 +259,7 @@ virNumaGetNodeCPUs(int node,
size_t i;
g_autofree unsigned long *mask = NULL;
g_autofree unsigned long *allonesmask = NULL;
VIR_AUTOPTR(virBitmap) cpumap = NULL;
g_autoptr(virBitmap) cpumap = NULL;
*cpus = NULL;
@ -312,7 +312,7 @@ int
virNumaNodesetToCPUset(virBitmapPtr nodeset,
virBitmapPtr *cpuset)
{
VIR_AUTOPTR(virBitmap) allNodesCPUs = NULL;
g_autoptr(virBitmap) allNodesCPUs = NULL;
size_t nodesetSize;
size_t i;
@ -325,7 +325,7 @@ virNumaNodesetToCPUset(virBitmapPtr nodeset,
nodesetSize = virBitmapSize(nodeset);
for (i = 0; i < nodesetSize; i++) {
VIR_AUTOPTR(virBitmap) nodeCPUs = NULL;
g_autoptr(virBitmap) nodeCPUs = NULL;
if (!virBitmapIsBitSet(nodeset, i))
continue;

View File

@ -460,7 +460,7 @@ virPCIDeviceIterDevices(virPCIDeviceIterPredicate predicate,
while ((ret = virDirRead(dir, &entry, PCI_SYSFS "devices")) > 0) {
unsigned int domain, bus, slot, function;
VIR_AUTOPTR(virPCIDevice) check = NULL;
g_autoptr(virPCIDevice) check = NULL;
char *tmp;
/* expected format: <domain>:<bus>:<slot>.<function> */
@ -782,8 +782,8 @@ virPCIDeviceTrySecondaryBusReset(virPCIDevicePtr dev,
int cfgfd,
virPCIDeviceList *inactiveDevs)
{
VIR_AUTOPTR(virPCIDevice) parent = NULL;
VIR_AUTOPTR(virPCIDevice) conflict = NULL;
g_autoptr(virPCIDevice) parent = NULL;
g_autoptr(virPCIDevice) conflict = NULL;
uint8_t config_space[PCI_CONF_LEN];
uint16_t ctl;
int ret = -1;
@ -1370,7 +1370,7 @@ virPCIDeviceNew(unsigned int domain,
unsigned int slot,
unsigned int function)
{
VIR_AUTOPTR(virPCIDevice) dev = NULL;
g_autoptr(virPCIDevice) dev = NULL;
g_autofree char *vendor = NULL;
g_autofree char *product = NULL;
@ -1624,7 +1624,7 @@ virPCIDeviceListAdd(virPCIDeviceListPtr list,
int
virPCIDeviceListAddCopy(virPCIDeviceListPtr list, virPCIDevicePtr dev)
{
VIR_AUTOPTR(virPCIDevice) copy = virPCIDeviceCopy(dev);
g_autoptr(virPCIDevice) copy = virPCIDeviceCopy(dev);
if (!copy)
return -1;
@ -1834,7 +1834,7 @@ static int
virPCIDeviceGetIOMMUGroupAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
{
virPCIDeviceListPtr groupList = opaque;
VIR_AUTOPTR(virPCIDevice) newDev = NULL;
g_autoptr(virPCIDevice) newDev = NULL;
if (!(newDev = virPCIDeviceNew(newDevAddr->domain, newDevAddr->bus,
newDevAddr->slot, newDevAddr->function)))
@ -2057,7 +2057,7 @@ virPCIDeviceDownstreamLacksACS(virPCIDevicePtr dev)
static int
virPCIDeviceIsBehindSwitchLackingACS(virPCIDevicePtr dev)
{
VIR_AUTOPTR(virPCIDevice) parent = NULL;
g_autoptr(virPCIDevice) parent = NULL;
if (virPCIDeviceGetParent(dev, &parent) < 0)
return -1;
@ -2081,7 +2081,7 @@ virPCIDeviceIsBehindSwitchLackingACS(virPCIDevicePtr dev)
* parent can be found
*/
do {
VIR_AUTOPTR(virPCIDevice) tmp = NULL;
g_autoptr(virPCIDevice) tmp = NULL;
int acs;
int ret;
@ -2616,7 +2616,7 @@ virPCIGetMdevTypes(const char *sysfspath,
DIR *dir = NULL;
struct dirent *entry;
g_autofree char *types_path = NULL;
VIR_AUTOPTR(virMediatedDeviceType) mdev_type = NULL;
g_autoptr(virMediatedDeviceType) mdev_type = NULL;
virMediatedDeviceTypePtr *mdev_types = NULL;
size_t ntypes = 0;
size_t i;

View File

@ -56,7 +56,7 @@ virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
{
ssize_t pos = -1;
ssize_t end;
VIR_AUTOPTR(virBitmap) bitmap = NULL;
g_autoptr(virBitmap) bitmap = NULL;
if (virJSONValueGetArrayAsBitmap(array, &bitmap) < 0)
return -1;

View File

@ -183,7 +183,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
bool readonly,
bool shareable)
{
VIR_AUTOPTR(virSCSIDevice) dev = NULL;
g_autoptr(virSCSIDevice) dev = NULL;
virSCSIDevicePtr ret = NULL;
g_autofree char *sg = NULL;
g_autofree char *vendor_path = NULL;
@ -273,7 +273,7 @@ virSCSIDeviceSetUsedBy(virSCSIDevicePtr dev,
const char *drvname,
const char *domname)
{
VIR_AUTOPTR(virUsedByInfo) copy = NULL;
g_autoptr(virUsedByInfo) copy = NULL;
if (VIR_ALLOC(copy) < 0)
return -1;
@ -440,7 +440,7 @@ virSCSIDeviceListDel(virSCSIDeviceListPtr list,
virSCSIDeviceUsedByInfoFree(dev->used_by[i]);
VIR_DELETE_ELEMENT(dev->used_by, i, dev->n_used_by);
} else {
VIR_AUTOPTR(virSCSIDevice) tmp = NULL;
g_autoptr(virSCSIDevice) tmp = NULL;
tmp = virSCSIDeviceListSteal(list, dev);
}
break;

View File

@ -250,7 +250,7 @@ virSCSIVHostDeviceGetPath(virSCSIVHostDevicePtr dev)
virSCSIVHostDevicePtr
virSCSIVHostDeviceNew(const char *name)
{
VIR_AUTOPTR(virSCSIVHostDevice) dev = NULL;
g_autoptr(virSCSIVHostDevice) dev = NULL;
virSCSIVHostDevicePtr ret = NULL;
if (VIR_ALLOC(dev) < 0)

View File

@ -1369,7 +1369,7 @@ int virStorageFileGetLVMKey(const char *path,
*/
int status;
int ret = -1;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList(LVS, "--noheadings",
"--unbuffered", "--nosuffix",
@ -1442,7 +1442,7 @@ virStorageFileGetSCSIKey(const char *path,
bool ignoreError G_GNUC_UNUSED)
{
int status;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList("/lib/udev/scsi_id",
"--replace-whitespace",
@ -1510,7 +1510,7 @@ virStorageFileGetNPIVKey(const char *path,
const char *serial;
const char *port;
g_autofree char *outbuf = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
cmd = virCommandNewArgList("/lib/udev/scsi_id",
"--replace-whitespace",
@ -1852,7 +1852,7 @@ virStorageAuthDefPtr
virStorageAuthDefCopy(const virStorageAuthDef *src)
{
virStorageAuthDefPtr ret = NULL;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
if (VIR_ALLOC(authdef) < 0)
return NULL;
@ -1879,7 +1879,7 @@ virStorageAuthDefParse(xmlNodePtr node,
xmlNodePtr saveNode = ctxt->node;
virStorageAuthDefPtr ret = NULL;
xmlNodePtr secretnode = NULL;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
g_autofree char *authtype = NULL;
ctxt->node = node;
@ -2680,7 +2680,7 @@ static int
virStorageSourceParseBackingURI(virStorageSourcePtr src,
const char *uristr)
{
VIR_AUTOPTR(virURI) uri = NULL;
g_autoptr(virURI) uri = NULL;
const char *path = NULL;
VIR_AUTOSTRINGLIST scheme = NULL;
@ -2829,7 +2829,7 @@ virStorageSourceParseRBDColonString(const char *rbdstr,
{
char *p, *e, *next;
g_autofree char *options = NULL;
VIR_AUTOPTR(virStorageAuthDef) authdef = NULL;
g_autoptr(virStorageAuthDef) authdef = NULL;
/* optionally skip the "rbd:" prefix if provided */
if (STRPREFIX(rbdstr, "rbd:"))
@ -3615,7 +3615,7 @@ static int
virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src,
virJSONValuePtr json)
{
VIR_AUTOPTR(virJSONValue) deflattened = NULL;
g_autoptr(virJSONValue) deflattened = NULL;
virJSONValuePtr file;
const char *drvname;
size_t i;
@ -3656,7 +3656,7 @@ static int
virStorageSourceParseBackingJSON(virStorageSourcePtr src,
const char *json)
{
VIR_AUTOPTR(virJSONValue) root = NULL;
g_autoptr(virJSONValue) root = NULL;
if (!(root = virJSONValueFromString(json)))
return -1;

View File

@ -174,7 +174,7 @@ virTPMExecGetCaps(virCommandPtr cmd,
int exitstatus;
virBitmapPtr bitmap;
g_autofree char *outbuf = NULL;
VIR_AUTOPTR(virJSONValue) json = NULL;
g_autoptr(virJSONValue) json = NULL;
virJSONValuePtr featureList;
virJSONValuePtr item;
size_t idx;
@ -234,7 +234,7 @@ static virBitmapPtr
virTPMGetCaps(TypeFromStringFn typeFromStringFn,
const char *exec, const char *param1)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
if (!(cmd = virCommandNew(exec)))
return NULL;

View File

@ -120,7 +120,7 @@ virUSBDeviceSearch(unsigned int vendor,
struct dirent *de;
virUSBDeviceListPtr list = NULL;
virUSBDeviceListPtr ret = NULL;
VIR_AUTOPTR(virUSBDevice) usb = NULL;
g_autoptr(virUSBDevice) usb = NULL;
int direrr;
if (!(list = virUSBDeviceListNew()))

View File

@ -1481,7 +1481,7 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups,
void virWaitForDevices(void)
{
VIR_AUTOPTR(virCommand) cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autofree char *udev = NULL;
int exitstatus;

View File

@ -414,7 +414,7 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
PRUint32 variant = HardDiskVariant_Standard;
resultCodeUnion resultCode;
virStorageVolPtr ret = NULL;
VIR_AUTOPTR(virStorageVolDef) def = NULL;
g_autoptr(virStorageVolDef) def = NULL;
if (!data->vboxObj)
return ret;

View File

@ -1275,7 +1275,7 @@ virVMXParseConfig(virVMXContext *ctx,
const char *vmx)
{
bool success = false;
VIR_AUTOPTR(virConf) conf = NULL;
g_autoptr(virConf) conf = NULL;
char *encoding = NULL;
char *utf8;
virDomainDefPtr def = NULL;

Some files were not shown because too many files have changed in this diff Show More