From: Christophe CURIS <[email protected]>
The cleanup function is actually not specific to loading images and could
do a lot more, so it is probably better placed in 'misc.c'
---
wrlib/imgformat.h | 2 ++
wrlib/load.c | 7 -------
wrlib/load_magick.c | 5 +++++
wrlib/misc.c | 12 ++++++++++++
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/wrlib/imgformat.h b/wrlib/imgformat.h
index 0d3b9d4..004da30 100644
--- a/wrlib/imgformat.h
+++ b/wrlib/imgformat.h
@@ -75,6 +75,8 @@ RImage *RLoadWEBP(const char *file);
#ifdef USE_MAGICK
RImage *RLoadMagick(const char *file_name);
+
+void RReleaseMagick(void);
#endif
/*
diff --git a/wrlib/load.c b/wrlib/load.c
index df0ae9f..4475070 100644
--- a/wrlib/load.c
+++ b/wrlib/load.c
@@ -103,13 +103,6 @@ char **RSupportedFileFormats(void)
return tmp;
}
-/* cleaning third-party libs at shutdown */
-void RShutdown() {
-#ifdef USE_MAGICK
- MagickWandTerminus();
-#endif
-}
-
static void init_cache(void)
{
char *tmp;
diff --git a/wrlib/load_magick.c b/wrlib/load_magick.c
index 009c554..e8201b9 100644
--- a/wrlib/load_magick.c
+++ b/wrlib/load_magick.c
@@ -86,3 +86,8 @@ bye:
return image;
}
+
+void RReleaseMagick(void)
+{
+ MagickWandTerminus();
+}
diff --git a/wrlib/misc.c b/wrlib/misc.c
index 4a7c065..00a7c57 100644
--- a/wrlib/misc.c
+++ b/wrlib/misc.c
@@ -26,6 +26,8 @@
#include <X11/Xlib.h>
#include "wraster.h"
+#include "imgformat.h"
+
void RBevelImage(RImage * image, int bevel_type)
{
@@ -240,3 +242,13 @@ const char *RMessageForError(int errorCode)
return "internal error";
}
}
+
+/*
+ * cleaning third-party libs at shutdown
+ */
+void RShutdown(void)
+{
+#ifdef USE_MAGICK
+ RReleaseMagick();
+#endif
+}
--
1.9.2
--
To unsubscribe, send mail to [email protected].