cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH v2 1/3] tool_metalink: introduce metalink_cleanup() in the internal API

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Wed, 31 Oct 2012 11:10:37 +0100

... to release resources allocated at global scope

---
 src/tool_metalink.c |    4 ++++
 src/tool_metalink.h |    5 +++++
 src/tool_operhlp.c  |    8 ++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 16689a3..a3d2c50 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -773,4 +773,8 @@ void clean_metalink(struct Configurable *config)
   config->metalinkfile_last = 0;
 }
 
+void metalink_cleanup(void)
+{
+}
+
 #endif /* USE_METALINK */
diff --git a/src/tool_metalink.h b/src/tool_metalink.h
index 49a6e64..c35f4a2 100644
--- a/src/tool_metalink.h
+++ b/src/tool_metalink.h
@@ -144,6 +144,11 @@ int metalink_check_hash(struct Configurable *config,
                         metalinkfile *mlfile,
                         const char *filename);
 
+/*
+ * Release resources allocated at global scope.
+ */
+void metalink_cleanup(void);
+
 #else /* USE_METALINK */
 
 #define count_next_metalink_resource(x)  0
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c
index e45f102..9078b95 100644
--- a/src/tool_operhlp.c
+++ b/src/tool_operhlp.c
@@ -32,6 +32,11 @@
 #include "tool_operhlp.h"
 #include "tool_version.h"
 
+#ifdef USE_METALINK
+/* import the declaration of metalink_cleanup() */
+#  include "tool_metalink.h"
+#endif
+
 #include "memdebug.h" /* keep this as LAST include */
 
 /*
@@ -215,6 +220,9 @@ void main_free(void)
 {
   curl_global_cleanup();
   convert_cleanup();
+#ifdef USE_METALINK
+  metalink_cleanup();
+#endif
 }
 
 #ifdef CURLDEBUG
-- 
1.7.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-31