unsigned int flags)
{
g_autoptr(virshDomain) dom = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
int nvcpus = 0;
unsigned int id;
ret = g_steal_pointer(&tmp);
cleanup:
- xmlFreeDoc(xml);
return ret;
}
unsigned int flags)
{
g_autoptr(virshDomain) dom = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
int nvcpus = 0;
unsigned int id;
ret = virshCommaStringListComplete(vcpuid, (const char **)vcpulist);
cleanup:
- xmlFreeDoc(xml);
return ret;
}
unsigned int flags)
{
char *desc = NULL;
- xmlDocPtr doc = NULL;
+ g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
int type;
desc = g_strdup("");
cleanup:
- xmlFreeDoc(doc);
return desc;
}
{
bool ret = false;
unsigned int flags = 0;
- xmlDocPtr xmldoc = NULL;
+ g_autoptr(xmlDoc) xmldoc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
int ndisks;
xmlNodePtr *disks = NULL;
VIR_FREE(device);
VIR_FREE(type);
VIR_FREE(disks);
- xmlFreeDoc(xmldoc);
return ret;
}
{
bool ret = false;
unsigned int flags = 0;
- xmlDocPtr xmldoc = NULL;
+ g_autoptr(xmlDoc) xmldoc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
int ninterfaces;
xmlNodePtr *interfaces = NULL;
cleanup:
vshTableFree(table);
VIR_FREE(interfaces);
- xmlFreeDoc(xmldoc);
return ret;
}
char *xpath = NULL;
virMacAddr macaddr;
char macstr[VIR_MAC_STRING_BUFLEN] = "";
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr *interfaces = NULL;
int ninterfaces;
VIR_FREE(state);
VIR_FREE(interfaces);
VIR_FREE(xpath);
- xmlFreeDoc(xml);
return ret;
}
unsigned int flags = 0;
unsigned int xmlflags = 0;
size_t i;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathObject) obj = NULL;
xmlNodePtr cur = NULL;
}
cleanup:
- xmlFreeDoc(xml);
VIR_FREE(xml_buf);
return ret;
int nvol_list = 0;
virshUndefineVolume *vols = NULL; /* info about the volumes to delete */
size_t nvols = 0;
- xmlDocPtr doc = NULL;
+ g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr *vol_nodes = NULL; /* XML nodes of volumes of the guest */
int nvol_nodes;
VIR_FREE(vol_list);
VIR_FREE(vol_nodes);
- xmlFreeDoc(doc);
return ret;
error:
int ret = -2;
virDomainInfo info;
int count;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
if (checkState &&
ret = count;
cleanup:
- xmlFreeDoc(xml);
return ret;
}
{
unsigned int flags = 0;
virBitmap *ret = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr *nodes = NULL;
int nnodes;
cleanup:
VIR_FREE(online);
VIR_FREE(nodes);
- xmlFreeDoc(xml);
return ret;
}
static bool
cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
{
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(virshDomain) dom = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
VIR_FREE(passwd);
VIR_FREE(listen_addr);
VIR_FREE(output);
- xmlFreeDoc(xml);
return ret;
}
static bool
cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd)
{
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(virshDomain) dom = NULL;
bool ret = false;
cleanup:
VIR_FREE(listen_addr);
- xmlFreeDoc(xml);
return ret;
}
static bool
cmdTTYConsole(vshControl *ctl, const vshCmd *cmd)
{
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
bool ret = false;
char *tty = NULL;
ret = true;
cleanup:
- xmlFreeDoc(xml);
VIR_FREE(tty);
return ret;
}
const char *type,
const char *mac)
{
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathObject) obj = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr cur = NULL, matchNode = NULL;
cleanup:
VIR_FREE(detach_xml);
- xmlFreeDoc(xml);
return ret == 0;
}
const char *path,
int type)
{
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathObject) obj = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr cur = NULL;
vshError(NULL, _("No disk found whose source path or target is %s"), path);
cleanup:
- xmlFreeDoc(xml);
return ret;
}
bool cellno = vshCommandOptBool(cmd, "cellno");
size_t i;
char *cap_xml = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
virshControl *priv = ctl->privData;
ret = true;
cleanup:
- xmlFreeDoc(xml);
VIR_FREE(nodes);
VIR_FREE(nodes_free);
VIR_FREE(nodes_id);
xmlNodePtr *nodes = NULL;
int nodes_cnt;
char *cap_xml = NULL;
- xmlDocPtr doc = NULL;
+ g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
bool all = vshCommandOptBool(cmd, "all");
bool cellno = vshCommandOptBool(cmd, "cellno");
ret = true;
cleanup:
- xmlFreeDoc(doc);
VIR_FREE(cap_xml);
VIR_FREE(nodes);
VIR_FREE(counts);
unsigned long long pageCounts[1], tmp;
unsigned int flags = 0;
char *cap_xml = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr *nodes = NULL;
virshControl *priv = ctl->privData;
ret = true;
cleanup:
- xmlFreeDoc(xml);
VIR_FREE(nodes);
VIR_FREE(cap_xml);
return ret;
const char *type = NULL;
int vcpus = -1;
char *caps = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
virshControl *priv = ctl->privData;
bool ret = false;
ret = true;
cleanup:
- xmlFreeDoc(xml);
VIR_FREE(caps);
return ret;
}
char **cpus = NULL;
char *buffer = NULL;
char *xmlStr = NULL;
- xmlDocPtr xml = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr *nodes = NULL;
char *doc;
cleanup:
VIR_FREE(buffer);
VIR_FREE(xmlStr);
- xmlFreeDoc(xml);
VIR_FREE(nodes);
return cpus;
char *if_xml = NULL;
xmlChar *br_xml = NULL;
int br_xml_size;
- xmlDocPtr xml_doc = NULL;
+ g_autoptr(xmlDoc) xml_doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr top_node, br_node, if_node, cur;
virshControl *priv = ctl->privData;
VIR_FREE(if_type);
VIR_FREE(if2_name);
VIR_FREE(delay_str);
- xmlFreeDoc(xml_doc);
return ret;
}
char *br_xml = NULL;
xmlChar *if_xml = NULL;
int if_xml_size;
- xmlDocPtr xml_doc = NULL;
+ g_autoptr(xmlDoc) xml_doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
xmlNodePtr top_node, if_node, cur;
virshControl *priv = ctl->privData;
VIR_FREE(br_xml);
VIR_FREE(if_type);
VIR_FREE(if_name);
- xmlFreeDoc(xml_doc);
return ret;
}
static xmlChar *
virshMakeCloneXML(const char *origxml, const char *newname)
{
- xmlDocPtr doc = NULL;
+ g_autoptr(xmlDoc) doc = NULL;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autoptr(xmlXPathObject) obj = NULL;
xmlChar *newxml = NULL;
xmlDocDumpMemory(doc, &newxml, &size);
cleanup:
- xmlFreeDoc(doc);
return newxml;
}