[librsvg] Deprecate rsvg_init and rsvg_term
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Deprecate rsvg_init and rsvg_term
- Date: Mon, 7 Nov 2011 19:29:13 +0000 (UTC)
commit 7f27418cfcdea9cdd6b2bf81ea0b0f6cc5a18b30
Author: Christian Persch <chpe gnome org>
Date: Mon Nov 7 19:57:08 2011 +0100
Deprecate rsvg_init and rsvg_term
rsvg_init() should be replaced by g_type_init(); we now call xmlInitParser()
in RsvgHandleClass::init.
rsvg_term() was dangerous to call, so just make it a no-op and add a new
rsvg_cleanup() that calls xmlCleanupParser(), for use only when you know
what you're doing.
https://bugzilla.gnome.org/show_bug.cgi?id=614157
doc/rsvg-sections.txt | 5 +++--
gdk-pixbuf-loader/io-svg.c | 3 ---
librsvg.def | 1 +
rsvg-base.c | 20 +++++++++++++++++---
rsvg-convert.c | 3 +--
rsvg-gobject.c | 2 ++
rsvg.h | 8 ++++++--
test-display.c | 6 ++----
tests/crash.c | 5 +++--
tests/dimensions.c | 5 +++--
tests/rsvg-test.c | 8 ++++----
tests/styles.c | 5 +++--
tools/rsvg-dimensions.c | 7 ++++---
tools/rsvg-tools-main.c | 4 ++--
14 files changed, 51 insertions(+), 31 deletions(-)
---
diff --git a/doc/rsvg-sections.txt b/doc/rsvg-sections.txt
index 8a8aefe..7614c56 100644
--- a/doc/rsvg-sections.txt
+++ b/doc/rsvg-sections.txt
@@ -9,8 +9,7 @@ RsvgHandlePrivate
RsvgHandleClass
RsvgDimensionData
RsvgPositionData
-rsvg_init
-rsvg_term
+rsvg_cleanup
rsvg_set_default_dpi
rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi
@@ -34,6 +33,8 @@ rsvg_error_get_type
RSVG_TYPE_ERROR
<SUBSECTION Deprecated>
+rsvg_init
+rsvg_term
rsvg_handle_free
RsvgSizeFunc
rsvg_handle_set_size_callback
diff --git a/gdk-pixbuf-loader/io-svg.c b/gdk-pixbuf-loader/io-svg.c
index 2844ee6..0afaed8 100644
--- a/gdk-pixbuf-loader/io-svg.c
+++ b/gdk-pixbuf-loader/io-svg.c
@@ -178,9 +178,6 @@ gdk_pixbuf__svg_image_stop_load (gpointer data, GError **error)
void
fill_vtable (GdkPixbufModule *module)
{
- /*todo: call this somewhere to make sure the gnome-vfs et. al. are initialized */
- /*rsvg_init ();*/
-
module->begin_load = gdk_pixbuf__svg_image_begin_load;
module->stop_load = gdk_pixbuf__svg_image_stop_load;
module->load_increment = gdk_pixbuf__svg_image_load_increment;
diff --git a/librsvg.def b/librsvg.def
index 5631342..37b30b3 100644
--- a/librsvg.def
+++ b/librsvg.def
@@ -2,6 +2,7 @@ rsvg_error_quark
rsvg_error_get_type
rsvg_init
rsvg_term
+rsvg_cleanup
rsvg_set_default_dpi
rsvg_set_default_dpi_x_y
rsvg_handle_set_dpi
diff --git a/rsvg-base.c b/rsvg-base.c
index 7d353dd..499ab75 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -1949,24 +1949,38 @@ rsvg_handle_new_from_stream_sync (GInputStream *stream,
*
* Initializes librsvg
* Since: 2.9
+ * Deprecated: 2.36: Use g_type_init()
**/
void
rsvg_init (void)
{
g_type_init ();
-
- xmlInitParser ();
}
/**
* rsvg_term:
*
- * De-initializes librsvg
+ * This function does nothing.
+ *
* Since: 2.9
+ * Deprecated: 2.36
**/
void
rsvg_term (void)
{
+}
+
+/**
+ * rsvg_cleanup:
+ *
+ * This function should not be called from normal programs.
+ * See xmlCleanupParser() for more information.
+ *
+ * Since: 2.36
+ **/
+void
+rsvg_cleanup (void)
+{
xmlCleanupParser ();
}
diff --git a/rsvg-convert.c b/rsvg-convert.c
index bec9beb..0c224b4 100644
--- a/rsvg-convert.c
+++ b/rsvg-convert.c
@@ -221,7 +221,6 @@ main (int argc, char **argv)
if (zoom != 1.0)
x_zoom = y_zoom = zoom;
- rsvg_init ();
rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
for (i = 0; i < n_args; i++) {
@@ -359,7 +358,7 @@ main (int argc, char **argv)
fclose (output_file);
- rsvg_term ();
+ rsvg_cleanup ();
return 0;
}
diff --git a/rsvg-gobject.c b/rsvg-gobject.c
index 36df226..16ecfdc 100644
--- a/rsvg-gobject.c
+++ b/rsvg-gobject.c
@@ -319,6 +319,8 @@ class_init (RsvgHandleClass * klass)
g_type_class_add_private (klass, sizeof (RsvgHandlePrivate));
+ xmlInitParser ();
+
rsvg_SAX_handler_struct_init ();
}
diff --git a/rsvg.h b/rsvg.h
index a2459b5..c4f43aa 100644
--- a/rsvg.h
+++ b/rsvg.h
@@ -118,8 +118,7 @@ struct _RsvgPositionData {
int y;
};
-void rsvg_init (void);
-void rsvg_term (void);
+void rsvg_cleanup (void);
void rsvg_set_default_dpi (double dpi);
void rsvg_set_default_dpi_x_y (double dpi_x, double dpi_y);
@@ -183,6 +182,11 @@ RsvgHandle *rsvg_handle_new_from_file (const gchar * file_name, GError ** error)
/* BEGIN deprecated APIs. Do not use! */
+RSVG_DEPRECATED_FOR(g_type_init)
+void rsvg_init (void);
+RSVG_DEPRECATED
+void rsvg_term (void);
+
RSVG_DEPRECATED_FOR(g_object_unref)
void rsvg_handle_free (RsvgHandle * handle);
diff --git a/test-display.c b/test-display.c
index b322626..0231ac0 100644
--- a/test-display.c
+++ b/test-display.c
@@ -805,9 +805,6 @@ main (int argc, char **argv)
return 1;
}
- /* initialize gtk+ and rsvg */
- rsvg_init ();
-
rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
/* if both are unspecified, assume user wants to zoom the pixbuf in at least 1 dimension */
@@ -915,7 +912,8 @@ main (int argc, char **argv)
done:
g_byte_array_free (info.svg_bytes, TRUE);
g_strfreev (args);
- rsvg_term ();
+
+ rsvg_cleanup ();
return retval;
}
diff --git a/tests/crash.c b/tests/crash.c
index aa5c1a9..43be8cb 100644
--- a/tests/crash.c
+++ b/tests/crash.c
@@ -39,14 +39,15 @@ main (int argc, char *argv[])
gint i;
int result;
- rsvg_init ();
+ g_type_init ();
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_crash);
result = g_test_run ();
- rsvg_term ();
+
+ rsvg_cleanup ();
return result;
}
diff --git a/tests/dimensions.c b/tests/dimensions.c
index 850bb45..1eda4fc 100644
--- a/tests/dimensions.c
+++ b/tests/dimensions.c
@@ -54,14 +54,15 @@ main (int argc, char *argv[])
gint i;
int result;
- rsvg_init ();
+ g_type_init ();
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_dimensions);
result = g_test_run ();
- rsvg_term ();
+
+ rsvg_cleanup ();
return result;
}
diff --git a/tests/rsvg-test.c b/tests/rsvg-test.c
index b0d9f98..e2b8aee 100644
--- a/tests/rsvg-test.c
+++ b/tests/rsvg-test.c
@@ -348,6 +348,8 @@ main (int argc, char **argv)
int i, j;
gsize length;
+ g_type_init ();
+
printf ("===============\n"
"Rendering tests\n"
"===============\n");
@@ -367,8 +369,6 @@ main (int argc, char **argv)
rsvg_test_html ("<html>\n");
rsvg_test_html ("<table>\n");
- rsvg_init ();
-
if (g_file_get_contents (TEST_LIST_FILENAME, &list_content, &length, NULL)) {
rsvg_set_default_dpi_x_y (72, 72);
@@ -403,8 +403,6 @@ main (int argc, char **argv)
} else
fprintf (stderr, "Error opening test list file "TEST_LIST_FILENAME"\n");
- rsvg_term ();
-
rsvg_test_html ("</table>\n");
rsvg_test_html ("</html>\n");
@@ -414,6 +412,8 @@ main (int argc, char **argv)
if (rsvg_test_log_file != NULL)
fclose (rsvg_test_log_file);
+ rsvg_cleanup ();
+
return status;
}
diff --git a/tests/styles.c b/tests/styles.c
index 4c0e5a6..81fb50e 100644
--- a/tests/styles.c
+++ b/tests/styles.c
@@ -114,7 +114,7 @@ main (int argc, char *argv[])
gint i;
int result;
- rsvg_init ();
+ g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id=");
@@ -122,7 +122,8 @@ main (int argc, char *argv[])
g_test_add_data_func (fixtures[i].test_name, &fixtures[i], (void*)test_value);
result = g_test_run ();
- rsvg_term ();
+
+ rsvg_cleanup ();
return result;
}
diff --git a/tools/rsvg-dimensions.c b/tools/rsvg-dimensions.c
index 442e892..8727b1f 100644
--- a/tools/rsvg-dimensions.c
+++ b/tools/rsvg-dimensions.c
@@ -40,7 +40,7 @@ main (int argc,
{ NULL }
};
- rsvg_init ();
+ g_type_init ();
context = NULL;
fragment = NULL;
@@ -128,7 +128,8 @@ bail:
g_option_context_free (context), context = NULL;
if (error)
g_error_free (error), error = NULL;
- rsvg_term ();
+
+ rsvg_cleanup ();
+
return exit_code;
}
-
diff --git a/tools/rsvg-tools-main.c b/tools/rsvg-tools-main.c
index 3212813..132db3a 100644
--- a/tools/rsvg-tools-main.c
+++ b/tools/rsvg-tools-main.c
@@ -128,7 +128,7 @@ rsvg_tools_main (int *argc, char ***argv)
exit (EXIT_FAILURE);
}
- rsvg_init ();
+ g_type_init ();
for (j = 0; j < n_args; j++) {
if (!read_contents (args[j], &contents, &length))
@@ -178,7 +178,7 @@ rsvg_tools_main (int *argc, char ***argv)
cairo_destroy (cr);
}
- rsvg_term ();
+ rsvg_cleanup ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]