summaryrefslogtreecommitdiff
path: root/gmodule
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2000-07-20 16:58:54 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2000-07-20 16:58:54 +0000
commitfec9828ac62918374fb8aa94e15a9bdf554e269e (patch)
tree7f327de3ead1d7355b5fa6144d6e264afb34e4e9 /gmodule
parent84114c5321e4d7e4701f77f7f0e2b9b739d4035c (diff)
Mark the functions g_basename and g_dirname deprecated. They will issue an
2000-07-20 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gutils.c, glib.h: Mark the functions g_basename and g_dirname deprecated. They will issue an warning once, when compiled with G_ENABLE_DEBUG, but continue to work as before. Instead the functions g_path_get_basename and g_path_get_dirname should be used, which BOTH return newly allocated memory, that has to freed by g_free. The new g_path_get_basename now strips trailing slashes from the path. This fixes #5097. For discussion see http://mail.gnome.org/pipermail/gtk-devel-list/2000-April/003139.html * gwin32.c, testglib.c, tests/dirname-test.c: Use the new functions instead of the old ones. * gmodule/libgplugin_a.c, gmodule/testgmodule.c: Use g_path_get_basename instead of the deprecated g_basename.
Diffstat (limited to 'gmodule')
-rw-r--r--gmodule/ChangeLog5
-rw-r--r--gmodule/libgplugin_a.c5
-rw-r--r--gmodule/testgmodule.c41
3 files changed, 39 insertions, 12 deletions
diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog
index 5450f6163..56e8c9d18 100644
--- a/gmodule/ChangeLog
+++ b/gmodule/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-20 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * libgplugin_a.c, testgmodule.c: Use g_path_get_basename instead
+ of the deprecated g_basename.
+
2000-07-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gmodule.h: include glib.h before doing extern "C". Makes some C++
diff --git a/gmodule/libgplugin_a.c b/gmodule/libgplugin_a.c
index 2a4ced70a..0920ebb9d 100644
--- a/gmodule/libgplugin_a.c
+++ b/gmodule/libgplugin_a.c
@@ -56,11 +56,12 @@ gplugin_a_module_func (GModule *module)
{
void (*f) (void) = NULL;
gchar *string;
+ gchar *basename = g_path_get_basename (g_module_name (module));
string = "gplugin_say_boo_func";
g_print ("GPluginA: retrive symbol `%s' from \"%s\"\n",
- string,
- g_basename (g_module_name (module)));
+ string, basename);
+ g_free (basename);
if (!g_module_symbol (module, string, (gpointer) &f))
{
g_print ("error: %s\n", g_module_error ());
diff --git a/gmodule/testgmodule.c b/gmodule/testgmodule.c
index 85f4c8db5..02d2ef5a8 100644
--- a/gmodule/testgmodule.c
+++ b/gmodule/testgmodule.c
@@ -46,6 +46,7 @@ main (int arg,
{
GModule *module_self, *module_a, *module_b;
gchar *string;
+ gchar *basename;
gchar *plugin_a, *plugin_b;
SimpleFunc f_a, f_b, f_self;
GModuleFunc gmod_f;
@@ -76,7 +77,9 @@ main (int arg,
}
g_print ("check that not yet bound symbols in shared libraries of main module are retrievable:\n");
string = "g_module_close";
- g_print ("retrive symbol `%s' from \"%s\":\n", string, g_basename (g_module_name (module_self)));
+ basename = g_path_get_basename (g_module_name (module_self));
+ g_print ("retrive symbol `%s' from \"%s\":\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_self, string, (gpointer) &f_self))
{
g_print ("error: %s\n", g_module_error ());
@@ -101,14 +104,18 @@ main (int arg,
/* get plugin specific symbols and call them
*/
string = "gplugin_a_func";
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
+ basename = g_path_get_basename (g_module_name (module_a));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
string = "gplugin_b_func";
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
+ basename = g_path_get_basename (g_module_name (module_b));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
@@ -122,19 +129,25 @@ main (int arg,
/* get and call globally clashing functions
*/
string = "g_clash_func";
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_self)));
+ basename = g_path_get_basename (g_module_name (module_self));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_self, string, (gpointer) &f_self))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
+ basename = g_path_get_basename (g_module_name (module_a));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
+ basename = g_path_get_basename (g_module_name (module_b));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
@@ -150,17 +163,23 @@ main (int arg,
/* get and call clashing plugin functions
*/
string = "gplugin_clash_func";
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_self)));
+ basename = g_path_get_basename (g_module_name (module_self));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_self, string, (gpointer) &f_self))
f_self = NULL;
g_print ("retrived function `%s' from self: %p\n", string, f_self);
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
+ basename = g_path_get_basename (g_module_name (module_a));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_a, string, (gpointer) &f_a))
{
g_print ("error: %s\n", g_module_error ());
return 1;
}
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_b)));
+ basename = g_path_get_basename (g_module_name (module_b));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_b, string, (gpointer) &f_b))
{
g_print ("error: %s\n", g_module_error ());
@@ -176,7 +195,9 @@ main (int arg,
/* call gmodule function form A
*/
string = "gplugin_a_module_func";
- g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a)));
+ basename = g_path_get_basename (g_module_name (module_a));
+ g_print ("retrive symbol `%s' from \"%s\"\n", string, basename);
+ g_free (basename);
if (!g_module_symbol (module_a, string, (gpointer) &gmod_f))
{
g_print ("error: %s\n", g_module_error ());