mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 10:27:51 +02:00
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.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
84114c5321
commit
fec9828ac6
@@ -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++
|
||||
|
@@ -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 ());
|
||||
|
@@ -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 ());
|
||||
|
Reference in New Issue
Block a user