mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-23 22:16:16 +01:00
applied patch from Christian Persch to support G_DEBUG flags
Mon Sep 11 14:58:56 2006 Tim Janik <timj@imendio.com> * gmodule.c: applied patch from Christian Persch to support G_DEBUG flags resident-modules and bind-now-modules, bug #345099.
This commit is contained in:
parent
323e56d824
commit
5c16431446
@ -1,3 +1,8 @@
|
||||
Mon Sep 11 14:58:56 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* gmodule.c: applied patch from Christian Persch to support
|
||||
G_DEBUG flags resident-modules and bind-now-modules, bug #345099.
|
||||
|
||||
2006-08-29 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
Remove support for Windows 9x/ME. GTK+ hasn't worked on Win9x
|
||||
|
@ -90,6 +90,8 @@ static inline GModule* g_module_find_by_name (const gchar *name);
|
||||
static GModule *modules = NULL;
|
||||
static GModule *main_module = NULL;
|
||||
static GStaticPrivate module_error_private = G_STATIC_PRIVATE_INIT;
|
||||
static gboolean module_debug_initialized = FALSE;
|
||||
static guint module_debug_flags = 0;
|
||||
|
||||
|
||||
/* --- inline functions --- */
|
||||
@ -299,6 +301,29 @@ str_check_suffix (const gchar* string,
|
||||
strcmp (string + string_len - suffix_len, suffix) == 0;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
G_MODULE_DEBUG_RESIDENT_MODULES = 1 << 0,
|
||||
G_MODULE_DEBUG_BIND_NOW_MODULES = 1 << 1
|
||||
};
|
||||
|
||||
static void
|
||||
_g_module_debug_init (void)
|
||||
{
|
||||
const GDebugKey keys[] = {
|
||||
{ "resident-modules", G_MODULE_DEBUG_RESIDENT_MODULES },
|
||||
{ "bind-now-modules", G_MODULE_DEBUG_BIND_NOW_MODULES }
|
||||
};
|
||||
const gchar *env;
|
||||
|
||||
env = g_getenv ("G_DEBUG");
|
||||
|
||||
module_debug_flags =
|
||||
!env ? 0 : g_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
|
||||
|
||||
module_debug_initialized = TRUE;
|
||||
}
|
||||
|
||||
static GStaticRecMutex g_module_global_lock = G_STATIC_REC_MUTEX_INIT;
|
||||
|
||||
GModule*
|
||||
@ -312,6 +337,13 @@ g_module_open (const gchar *file_name,
|
||||
SUPPORT_OR_RETURN (NULL);
|
||||
|
||||
g_static_rec_mutex_lock (&g_module_global_lock);
|
||||
|
||||
if (G_UNLIKELY (!module_debug_initialized))
|
||||
_g_module_debug_init ();
|
||||
|
||||
if (module_debug_flags & G_MODULE_DEBUG_BIND_NOW_MODULES)
|
||||
flags &= ~G_MODULE_BIND_LAZY;
|
||||
|
||||
if (!file_name)
|
||||
{
|
||||
if (!main_module)
|
||||
@ -468,6 +500,10 @@ g_module_open (const gchar *file_name,
|
||||
g_free (saved_error);
|
||||
}
|
||||
|
||||
if (module != NULL &&
|
||||
(module_debug_flags & G_MODULE_DEBUG_RESIDENT_MODULES))
|
||||
g_module_make_resident (module);
|
||||
|
||||
g_static_rec_mutex_unlock (&g_module_global_lock);
|
||||
return module;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user