mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-29 21:33:30 +02:00
fixed errernerous code wrt to thread specific error string allocation
Wed Feb 10 07:56:33 1999 Tim Janik <timj@gtk.org> * gmodule.c (g_module_error): fixed errernerous code wrt to thread specific error string allocation handling. Wed Feb 10 06:20:30 1999 Tim Janik <timj@gtk.org> * gmutex.c (g_static_private_set): invoke destroy notifier when overwriting values, initialize new array fields with NULL. (g_static_private_free_data): do not skip destroy notification for data == NULL. * gutils.c (g_direct_equal): compare pointer values directly instead of just their guint values which is a loosing conversion for sizeof(gpointer)==8 systems. (g_get_any_init): restructured code so we don't use endless loops like while (1), which boil down to an ugly alias for goto. strip ,.* from the real name.
This commit is contained in:
@@ -114,15 +114,8 @@ g_module_find_by_name (const gchar *name)
|
||||
static inline void
|
||||
g_module_set_error (const gchar *error)
|
||||
{
|
||||
gchar* module_error = g_static_private_get (&module_error_private);
|
||||
if (module_error)
|
||||
g_free (module_error);
|
||||
if (error)
|
||||
module_error = g_strdup (error);
|
||||
else
|
||||
module_error = NULL;
|
||||
g_static_private_set (&module_error_private, g_strdup (error), g_free);
|
||||
errno = 0;
|
||||
g_static_private_set (&module_error_private, module_error, g_free);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,8 +239,7 @@ g_module_open (const gchar *file_name,
|
||||
return module;
|
||||
}
|
||||
|
||||
saved_error = g_module_error();
|
||||
g_static_private_set (&module_error_private, NULL, NULL);
|
||||
saved_error = g_strdup (g_module_error ());
|
||||
g_module_set_error (NULL);
|
||||
|
||||
module = g_new (GModule, 1);
|
||||
@@ -281,6 +273,7 @@ g_module_open (const gchar *file_name,
|
||||
}
|
||||
else
|
||||
g_module_set_error (saved_error);
|
||||
|
||||
g_free (saved_error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user