Re: [libvirt] [PATCH] virsh: Use VIR_FREE instead of free

2010-01-06 Thread Daniel Veillard
On Sun, Jan 03, 2010 at 08:43:15PM +0100, Matthias Bolte wrote:
 virsh uses other parts of the internal API already, so use VIR_FREE also.
 ---
  tools/virsh.c |  297 
 -
  1 files changed, 146 insertions(+), 151 deletions(-)

  I really though it was not available there, but if it's possible, nice !

  ACK

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] virsh: Use VIR_FREE instead of free

2010-01-06 Thread Matthias Bolte
2010/1/6 Daniel Veillard veill...@redhat.com:
 On Sun, Jan 03, 2010 at 08:43:15PM +0100, Matthias Bolte wrote:
 virsh uses other parts of the internal API already, so use VIR_FREE also.
 ---
  tools/virsh.c |  297 
 -
  1 files changed, 146 insertions(+), 151 deletions(-)

  I really though it was not available there, but if it's possible, nice !

  ACK

 Daniel


Pushed the 8 ACKed patches.

Matthias

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] virsh: Use VIR_FREE instead of free

2010-01-03 Thread Matthias Bolte
virsh uses other parts of the internal API already, so use VIR_FREE also.
---
 tools/virsh.c |  297 -
 1 files changed, 146 insertions(+), 151 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index e2a32b4..2844927 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -46,6 +46,7 @@
 #include buf.h
 #include console.h
 #include util.h
+#include memory.h
 
 static char *progname;
 
@@ -481,7 +482,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
 ctl-conn = NULL;
 }
 
-free(ctl-name);
+VIR_FREE(ctl-name);
 ctl-name = vshStrdup(ctl, vshCommandOptString(cmd, name, NULL));
 
 if (!ro) {
@@ -560,7 +561,7 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom)
 xml = xmlReadDoc((const xmlChar *) doc, domain.xml, NULL,
  XML_PARSE_NOENT | XML_PARSE_NONET |
  XML_PARSE_NOWARNING);
-free(doc);
+VIR_FREE(doc);
 if (!xml)
 goto cleanup;
 ctxt = xmlXPathNewContext(xml);
@@ -583,8 +584,8 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom)
 xmlXPathFreeContext(ctxt);
 if (xml)
 xmlFreeDoc(xml);
-free(thisHost);
-free(thatHost);
+VIR_FREE(thisHost);
+VIR_FREE(thatHost);
 
 return ret;
 }
@@ -651,7 +652,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 
 if ((maxid = virConnectListDomains(ctl-conn, ids[0], maxid))  
0) {
 vshError(ctl, %s, _(Failed to list active domains));
-free(ids);
+VIR_FREE(ids);
 return FALSE;
 }
 
@@ -662,7 +663,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 maxname = virConnectNumOfDefinedDomains(ctl-conn);
 if (maxname  0) {
 vshError(ctl, %s, _(Failed to list inactive domains));
-free(ids);
+VIR_FREE(ids);
 return FALSE;
 }
 if (maxname) {
@@ -670,8 +671,8 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 
 if ((maxname = virConnectListDefinedDomains(ctl-conn, names, 
maxname))  0) {
 vshError(ctl, %s, _(Failed to list inactive domains));
-free(ids);
-free(names);
+VIR_FREE(ids);
+VIR_FREE(names);
 return FALSE;
 }
 
@@ -708,7 +709,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
 
 /* this kind of work with domains is not atomic operation */
 if (!dom) {
-free(names[i]);
+VIR_FREE(names[i]);
 continue;
 }
 
@@ -720,10 +721,10 @@ cmdList(vshControl *ctl, const vshCmd *cmd 
ATTRIBUTE_UNUSED)
 vshPrint(ctl, %3s %-20s %s\n, -, names[i], state);
 
 virDomainFree(dom);
-free(names[i]);
+VIR_FREE(names[i]);
 }
-free(ids);
-free(names);
+VIR_FREE(ids);
+VIR_FREE(names);
 return TRUE;
 }
 
@@ -1019,7 +1020,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
 return FALSE;
 
 dom = virDomainCreateXML(ctl-conn, buffer, 0);
-free (buffer);
+VIR_FREE(buffer);
 
 if (dom != NULL) {
 vshPrint(ctl, _(Domain %s created from %s\n),
@@ -1070,7 +1071,7 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
 return FALSE;
 
 dom = virDomainDefineXML(ctl-conn, buffer);
-free (buffer);
+VIR_FREE(buffer);
 
 if (dom != NULL) {
 vshPrint(ctl, _(Domain %s defined from %s\n),
@@ -1371,7 +1372,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
 if (schedulertype!= NULL){
 vshPrint(ctl, %-15s: %s\n, _(Scheduler),
  schedulertype);
-free(schedulertype);
+VIR_FREE(schedulertype);
 } else {
 vshPrint(ctl, %-15s: %s\n, _(Scheduler), _(Unknown));
 goto cleanup;
@@ -1436,7 +1437,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
 }
 
  cleanup:
-free(params);
+VIR_FREE(params);
 virDomainFree(dom);
 return ret_val;
 }
@@ -1724,7 +1725,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
 
 if ((str = virDomainGetOSType(dom))) {
 vshPrint(ctl, %-15s %s\n, _(OS Type:), str);
-free(str);
+VIR_FREE(str);
 }
 
 if (virDomainGetInfo(dom, info) == 0) {
@@ -1912,8 +1913,8 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 ret = FALSE;
 }
 
-free(cpumap);
-free(cpuinfo);
+VIR_FREE(cpumap);
+VIR_FREE(cpuinfo);
 virDomainFree(dom);
 return ret;
 }
@@ -2037,7 +2038,7 @@ cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
 VIR_USE_CPU(cpumap, cpu);
 } else {
 vshError(ctl, _(Physical CPU %d doesn't exist.), cpu);
-free(cpumap);
+VIR_FREE(cpumap);
 virDomainFree(dom);
 return FALSE;
 }
@@ -2050,7 +2051,7 @@ cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
 ret = FALSE;
 }
 
-