[Libguestfs] [PATCH 07/67] internal: Add CLEANUP_XMLFREEURI (cleanup function for xmlURIPtr).

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 11:04:07 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

(cherry picked from commit 0e1ba00059b5ebbca2e137f2685b2eb65ed33b13)
---
 src/cleanup.c                   | 10 ++++++++++
 src/guestfs-internal-frontend.h |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/src/cleanup.c b/src/cleanup.c
index 43d746e..13018f0 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <libxml/uri.h>
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
 #include <libxml/xmlwriter.h>
@@ -87,6 +88,15 @@ guestfs___cleanup_xmlFreeDoc (void *ptr)
 }
 
 void
+guestfs___cleanup_xmlFreeURI (void *ptr)
+{
+  xmlURIPtr uri = * (xmlURIPtr *) ptr;
+
+  if (uri)
+    xmlFreeURI (uri);
+}
+
+void
 guestfs___cleanup_xmlFreeTextWriter (void *ptr)
 {
   xmlTextWriterPtr xo = * (xmlTextWriterPtr *) ptr;
diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h
index 9cb3664..db6122f 100644
--- a/src/guestfs-internal-frontend.h
+++ b/src/guestfs-internal-frontend.h
@@ -47,6 +47,8 @@
   __attribute__((cleanup(guestfs___cleanup_xmlBufferFree)))
 #define CLEANUP_XMLFREEDOC                                      \
   __attribute__((cleanup(guestfs___cleanup_xmlFreeDoc)))
+#define CLEANUP_XMLFREEURI                                              \
+  __attribute__((cleanup(guestfs___cleanup_xmlFreeURI)))
 #define CLEANUP_XMLFREETEXTWRITER                               \
   __attribute__((cleanup(guestfs___cleanup_xmlFreeTextWriter)))
 #define CLEANUP_XMLXPATHFREECONTEXT                                     \
@@ -60,6 +62,7 @@
 #define CLEANUP_UNLINK_FREE
 #define CLEANUP_XMLBUFFERFREE
 #define CLEANUP_XMLFREEDOC
+#define CLEANUP_XMLFREEURI
 #define CLEANUP_XMLFREETEXTWRITER
 #define CLEANUP_XMLXPATHFREECONTEXT
 #define CLEANUP_XMLXPATHFREEOBJECT
@@ -104,6 +107,7 @@ extern void guestfs___cleanup_hash_free (void *ptr);
 extern void guestfs___cleanup_unlink_free (void *ptr);
 extern void guestfs___cleanup_xmlBufferFree (void *ptr);
 extern void guestfs___cleanup_xmlFreeDoc (void *ptr);
+extern void guestfs___cleanup_xmlFreeURI (void *ptr);
 extern void guestfs___cleanup_xmlFreeTextWriter (void *ptr);
 extern void guestfs___cleanup_xmlXPathFreeContext (void *ptr);
 extern void guestfs___cleanup_xmlXPathFreeObject (void *ptr);
-- 
1.8.3.1




More information about the Libguestfs mailing list