[lasem] lsm: add lsm_shutdown, which frees ressources for debugging.



commit 0509639f2db613cccb366d421b807775fa1d31cf
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Thu Nov 18 22:22:06 2010 +0100

    lsm: add lsm_shutdown, which frees ressources for debugging.

 docs/reference/lasem/lasem-sections.txt |    1 +
 src/Makefile.am                         |    1 +
 src/lsm.c                               |   30 ++++++++++++++++++++++++++++++
 src/lsmdomimplementation.c              |   20 ++++++++++----------
 src/lsmdomimplementation.h              |    2 ++
 tests/dom.c                             |    6 ++++--
 tests/suite.c                           |    2 ++
 7 files changed, 50 insertions(+), 12 deletions(-)
---
diff --git a/docs/reference/lasem/lasem-sections.txt b/docs/reference/lasem/lasem-sections.txt
index fb8ba82..e64d24c 100644
--- a/docs/reference/lasem/lasem-sections.txt
+++ b/docs/reference/lasem/lasem-sections.txt
@@ -77,6 +77,7 @@ LsmDomDocument
 LsmDomDocumentCreateFunction
 lsm_dom_implementation_create_document
 lsm_dom_implementation_add_document_create_function
+lsm_dom_implementation_cleanup
 lsm_dom_document_new_from_memory
 lsm_dom_document_new_from_path
 lsm_dom_document_new_from_url
diff --git a/src/Makefile.am b/src/Makefile.am
index 5121d8a..f5352a1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,7 @@ liblasem_ LASEM_API_VERSION@_la_LIBADD = 	\
 	$(LASEM_LIBS)
 
 LASEM_DOM_SRCS =				\
+	lsm.c					\
 	lsmdebug.c				\
 	lsmstr.c				\
 	lsmtraits.c				\
diff --git a/src/lsm.c b/src/lsm.c
new file mode 100644
index 0000000..ac56028
--- /dev/null
+++ b/src/lsm.c
@@ -0,0 +1,30 @@
+/* Lasem - SVG and Mathml library
+ *
+ * Copyright © 2010 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * 	Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#include <lsmdomimplementation.h>
+
+void
+lsm_shutdown (void)
+{
+	lsm_dom_implementation_cleanup ();
+}
diff --git a/src/lsmdomimplementation.c b/src/lsmdomimplementation.c
index fbbd8a3..a5d3349 100644
--- a/src/lsmdomimplementation.c
+++ b/src/lsmdomimplementation.c
@@ -39,16 +39,6 @@ lsm_dom_implementation_add_create_function (const char *qualified_name,
 	g_hash_table_insert (document_types, g_strdup (qualified_name), create_function);
 }
 
-void
-lsm_dom_implementation_cleanup (void)
-{
-	if (document_types == NULL)
-		return;
-
-	g_hash_table_unref (document_types);
-	document_types = NULL;
-}
-
 LsmDomDocument *
 lsm_dom_implementation_create_document (const char *namespace_uri,
 					const char *qualified_name)
@@ -71,3 +61,13 @@ lsm_dom_implementation_create_document (const char *namespace_uri,
 
 	return create_function ();
 }
+
+void
+lsm_dom_implementation_cleanup (void)
+{
+	if (document_types == NULL)
+		return;
+
+	g_hash_table_unref (document_types);
+	document_types = NULL;
+}
diff --git a/src/lsmdomimplementation.h b/src/lsmdomimplementation.h
index 0c7ae40..15081c9 100644
--- a/src/lsmdomimplementation.h
+++ b/src/lsmdomimplementation.h
@@ -36,6 +36,8 @@ LsmDomDocument *	lsm_dom_implementation_create_document 			(const char *namespac
 void			lsm_dom_implementation_add_document_create_function	(const char *qualified_name,
 										 LsmDomDocumentCreateFunction create_function);
 
+void			lsm_dom_implementation_cleanup 				(void);
+
 G_END_DECLS
 
 #endif
diff --git a/tests/dom.c b/tests/dom.c
index 1a51374..18190f8 100644
--- a/tests/dom.c
+++ b/tests/dom.c
@@ -151,7 +151,7 @@ insert_before_test (void)
 int
 main (int argc, char *argv[])
 {
-	int i;
+	int result;
 
 	g_test_init (&argc, &argv, NULL);
 
@@ -163,5 +163,7 @@ main (int argc, char *argv[])
 
 	g_type_init ();
 
-	return g_test_run();
+	result = g_test_run();
+
+	lsm_shutdown ();
 }
diff --git a/tests/suite.c b/tests/suite.c
index 404b3de..469ff43 100644
--- a/tests/suite.c
+++ b/tests/suite.c
@@ -117,5 +117,7 @@ main (int argc, char *argv[])
 	g_slist_free (files);
 	g_regex_unref (filename_regex);
 
+	lsm_shutdown ();
+
 	return result;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]