recent gmodule.c change




hi martin,

what is the exact intend of this?
either you extern a function g_module_check_init() in a module,
and then have to expect to have it called, or you don't, in which
case the symbol will not be found.
the only case i can imagine where check_init() will be NULL is with
something like:

gpointer g_module_check_init = NULL;

which can be read as "i want to get in trouble" since g_module_check_init()
has to be a function according to:

typedef const gchar* (*GModuleCheckInit) (GModule       *module);


Change in question:

2000-01-13  Martin Baulig  <martin@home-of-linux.org>

        * gmodule.c (g_module_open): Check whether `check_init' is not NULL
        before we attempt to call it.

Index: gmodule.c
===================================================================
RCS file: /cvs/gnome/glib/gmodule/gmodule.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -u -r1.24 -r1.25
--- gmodule.c   1999/07/24 18:50:57     1.24
+++ gmodule.c   2000/01/13 22:11:39     1.25
@@ -256,7 +256,8 @@

       /* check initialization */
       if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init))
-       check_failed = check_init (module);
+        if (check_init)
+          check_failed = check_init (module);

       /* we don't call unload() if the initialization check failed. */
       if (!check_failed)


---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]