implemented g_datalist_* along the lines of g_dataset, but operates on an

Thu Sep 17 06:36:25 1998  Tim Janik  <timj@gtk.org>

        * glib.h:
        * gdataset.c: implemented g_datalist_* along the lines of g_dataset,
        but operates on an opaque gpointer *datalist; pointer, e.g. for the
        implementation of GtkObject named data.
        we cache a certain portion of the already freed data entries now, to
        gain a slight performance improve with data reallocation.

Thu Sep 17 06:34:22 1998  Tim Janik  <timj@gtk.org>

        * gmodule.h:
        * gmodule.c: implemented g_module_make_resident() which can be
        used to make modules resident.
        fixed a buglet about the optional "g_module_de_init" function in
        modules, which could get invoked twice on very obscure occasions.
This commit is contained in:
Tim Janik
1998-09-17 04:59:41 +00:00
committed by Tim Janik
parent 7cc610b064
commit ea4b8e4c02
15 changed files with 737 additions and 295 deletions

View File

@@ -1,3 +1,11 @@
Thu Sep 17 06:34:22 1998 Tim Janik <timj@gtk.org>
* gmodule.h:
* gmodule.c: implemented g_module_make_resident() which can be
used to make modules resident.
fixed a buglet about the optional "g_module_de_init" function in
modules, which could get invoked twice on very obscure occasions.
Tue Sep 15 14:57:30 1998 Owen Taylor <otaylor@redhat.com>
* Makefile.am: Update to libtool-1.2b,
@@ -51,7 +59,7 @@ Sun Aug 9 15:57:38 1998 Tim Janik <timj@gtk.org>
* gmodule.h:
* gmodule.c: GModule library implementation, which is basically
a wrapper about system specifc dynamic loading functions.
a wrapper about system specifc dynamic loading facilities.
Sun Aug 9 10:31:05 1998 Tim Janik <timj@gtk.org>

View File

@@ -36,7 +36,8 @@ struct _GModule
{
gchar *file_name;
gpointer handle;
guint ref_count;
guint ref_count : 31;
guint is_resident : 1;
GModuleDeInit de_init;
GModule *next;
};
@@ -164,6 +165,7 @@ g_module_open (const gchar *file_name,
main_module->file_name = NULL;
main_module->handle = handle;
main_module->ref_count = 1;
main_module->is_resident = TRUE;
main_module->de_init = NULL;
main_module->next = NULL;
}
@@ -208,6 +210,7 @@ g_module_open (const gchar *file_name,
module->file_name = g_strdup (file_name);
module->handle = handle;
module->ref_count = 1;
module->is_resident = FALSE;
module->de_init = NULL;
module->next = modules;
modules = module;
@@ -246,12 +249,18 @@ g_module_close (GModule *module)
g_return_val_if_fail (module != NULL, FALSE);
g_return_val_if_fail (module->ref_count > 0, FALSE);
if (module != main_module)
module->ref_count--;
module->ref_count--;
if (!module->ref_count && module->de_init)
module->de_init (module);
if (!module->ref_count)
if (!module->ref_count && !module->is_resident && module->de_init)
{
GModuleDeInit de_init;
de_init = module->de_init;
module->de_init = NULL;
de_init (module);
}
if (!module->ref_count && !module->is_resident)
{
GModule *last;
GModule *node;
@@ -282,6 +291,14 @@ g_module_close (GModule *module)
return module_error == NULL;
}
void
g_module_make_resident (GModule *module)
{
g_return_if_fail (module != NULL);
module->is_resident = TRUE;
}
gchar*
g_module_error (void)
{

View File

@@ -56,6 +56,9 @@ GModule* g_module_open (const gchar *file_name,
/* close a previously opened module, returns TRUE on success */
gboolean g_module_close (GModule *module);
/* make a module resident so g_module_close on it will be ignored */
void g_module_make_resident (GModule *module);
/* query the last module error as a string */
gchar* g_module_error (void);