[Pkg-libvirt-commits] [libguestfs] 41/266: cleanups: add CLEANUP_FCLOSE (fclose on FILE*)

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.

commit 9e7f5300c93c77f899d2bf543858e94608e6286f
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Fri Jul 25 17:36:15 2014 +0200

    cleanups: add CLEANUP_FCLOSE (fclose on FILE*)
---
 src/cleanup.c                   | 9 +++++++++
 src/guestfs-internal-frontend.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/cleanup.c b/src/cleanup.c
index 86bb547..4e1a7f9 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -122,3 +122,12 @@ guestfs___cleanup_xmlXPathFreeObject (void *ptr)
   if (obj)
     xmlXPathFreeObject (obj);
 }
+
+void
+guestfs___cleanup_fclose (void *ptr)
+{
+  FILE *f = * (FILE **) ptr;
+
+  if (f)
+    fclose (f);
+}
diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h
index 3129018..1e59ad1 100644
--- a/src/guestfs-internal-frontend.h
+++ b/src/guestfs-internal-frontend.h
@@ -55,6 +55,7 @@
   __attribute__((cleanup(guestfs___cleanup_xmlXPathFreeContext)))
 #define CLEANUP_XMLXPATHFREEOBJECT                                      \
   __attribute__((cleanup(guestfs___cleanup_xmlXPathFreeObject)))
+#define CLEANUP_FCLOSE __attribute__((cleanup(guestfs___cleanup_fclose)))
 #else
 #define CLEANUP_FREE
 #define CLEANUP_FREE_STRING_LIST
@@ -66,6 +67,7 @@
 #define CLEANUP_XMLFREETEXTWRITER
 #define CLEANUP_XMLXPATHFREECONTEXT
 #define CLEANUP_XMLXPATHFREEOBJECT
+#define CLEANUP_FCLOSE
 #endif
 
 /* NB: At some point we will stop exporting these safe_* allocation
@@ -115,6 +117,7 @@ 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);
+extern void guestfs___cleanup_fclose (void *ptr);
 
 /* These are in a separate header so the header can be generated.
  * Don't include the following file directly:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list