[Pkg-libvirt-commits] [libguestfs] 98/156: cleanups: add CLEANUP_FCLOSE (fclose on FILE*)
Hilko Bengen
bengen at moszumanska.debian.org
Sat Aug 30 08:26:02 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit bb4babc52388971f125f9b7975e560ba86744bf2
Author: Pino Toscano <ptoscano at redhat.com>
Date: Fri Jul 25 17:36:15 2014 +0200
cleanups: add CLEANUP_FCLOSE (fclose on FILE*)
(cherry picked from commit 9e7f5300c93c77f899d2bf543858e94608e6286f)
---
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