diff --git a/src/gnc-module/gnc-module.c b/src/gnc-module/gnc-module.c index b1999ab35c..8687aac412 100644 --- a/src/gnc-module/gnc-module.c +++ b/src/gnc-module/gnc-module.c @@ -23,6 +23,15 @@ static GHashTable * loaded_modules = NULL; static GList * module_info = NULL; +typedef struct { + char * module_path; + char * module_description; + char * module_filepath; + int module_interface; + int module_age; + int module_revision; +} GNCModuleInfo; + typedef struct { lt_dlhandle handle; @@ -32,6 +41,7 @@ typedef struct int (* init_func)(int refcount); } GNCLoadedModule; +static GNCModuleInfo * gnc_module_get_info(const char * lib_path); /************************************************************* * gnc_module_system_search_dirs @@ -192,15 +202,15 @@ gnc_module_system_refresh(void) /* look in each search directory */ for(current = search_dirs; current; current = current->next) { - DIR * d = opendir(current->data); - struct dirent * dent = NULL; - char * fullpath = NULL; - int namelen; - GNCModuleInfo * info; - - if(d) - { - while((dent = readdir(d)) != NULL) + DIR *d = opendir(current->data); + struct dirent * dent = NULL; + char * fullpath = NULL; + int namelen; + GNCModuleInfo * info; + + if (!d) continue; + + while ((dent = readdir(d)) != NULL) { namelen = strlen(dent->d_name); @@ -221,7 +231,7 @@ gnc_module_system_refresh(void) } } closedir(d); - } + } /* free the search dir strings */ for(current = search_dirs; current; current=current->next) @@ -255,7 +265,7 @@ gnc_module_system_modinfo(void) * if it's a gnc_module, return a struct describing it. *************************************************************/ -GNCModuleInfo * +static GNCModuleInfo * gnc_module_get_info(const char * fullpath) { lt_dlhandle handle; @@ -568,38 +578,3 @@ gnc_module_unload(GNCModule module) } } - -/************************************************************* - * gnc_module_lookup - * find a symbol in a module - *************************************************************/ - -void * -gnc_module_lookup(GNCModule module, gchar * symbol) -{ - GNCLoadedModule * info; - lt_ptr ltptr; - - if(!loaded_modules) - { - gnc_module_system_init(); - } - - if(module && symbol) - { - info = g_hash_table_lookup(loaded_modules, module); - if(info) - { - ltptr = lt_dlsym(info->handle, symbol); - return (void *)ltptr; - } - else - { - return NULL; - } - } - else - { - return NULL; - } -} diff --git a/src/gnc-module/gnc-module.h b/src/gnc-module/gnc-module.h index 6084853848..bcf1bf58ad 100644 --- a/src/gnc-module/gnc-module.h +++ b/src/gnc-module/gnc-module.h @@ -16,15 +16,6 @@ typedef void * GNCModule; -typedef struct { - char * module_path; - char * module_description; - char * module_filepath; - int module_interface; - int module_age; - int module_revision; -} GNCModuleInfo; - #define DEFAULT_MODULE_PATH "/usr/local/gnucash/lib/modules" /* the basics: initialize the module system, refresh its module @@ -43,11 +34,5 @@ GList * gnc_module_system_modinfo(void); GNCModule gnc_module_load(gchar * module_name, gint interface); GNCModule gnc_module_load_optional(gchar * module_name, gint interface); int gnc_module_unload(GNCModule mod); -GNCModuleInfo * gnc_module_get_info(const char * lib_path); -int gnc_module_use_scm_module(gchar * module_path); - -/* gnc_module_lookup locates the given 'symbol' in module - * 'mod'. 'mod' must be previously loaded. */ -void * gnc_module_lookup(GNCModule mod, gchar * symbol); #endif diff --git a/src/gnc-module/gnc-module.scm b/src/gnc-module/gnc-module.scm index 99186cb43f..bce739e796 100644 --- a/src/gnc-module/gnc-module.scm +++ b/src/gnc-module/gnc-module.scm @@ -22,7 +22,6 @@ (re-export gnc:module-load) (re-export gnc:module-load-optional) (re-export gnc:module-unload) -(re-export gnc:module-lookup) (define (gnc:module-system-init) (let ((lib (if (or (string=? (version) "1.3") diff --git a/src/gnc-module/gw-gnc-module-spec.scm b/src/gnc-module/gw-gnc-module-spec.scm index 3166f2a194..0ac0e01297 100644 --- a/src/gnc-module/gw-gnc-module-spec.scm +++ b/src/gnc-module/gw-gnc-module-spec.scm @@ -44,10 +44,5 @@ '(( module)) "Unreference a gnc-module. Module will unload when refcount goes to 0") - (gw:wrap-function - ws 'gnc:module-lookup - ' "gnc_module_lookup" - '(( module) - (( caller-owned) symbol)) - "Look up a symbol in the module. module must be loaded already.")) +) diff --git a/src/gnc-module/test/test-load-c.c b/src/gnc-module/test/test-load-c.c index d9b9436870..e360253f91 100644 --- a/src/gnc-module/test/test-load-c.c +++ b/src/gnc-module/test/test-load-c.c @@ -8,8 +8,6 @@ static void guile_main(void *closure, int argc, char ** argv) { - int (*foo_hello)(void); - int helloval; GNCModule foo; printf(" test-load-c.c: testing module load/unload from C ... "); @@ -22,13 +20,6 @@ guile_main(void *closure, int argc, char ** argv) printf(" Failed to load foo\n"); exit(-1); } - - foo_hello = gnc_module_lookup(foo, "foo_hello"); - helloval = foo_hello(); - if(helloval != 10) { - printf(" Call of module function failed.\n"); - exit(-1); - } if(!gnc_module_unload(foo)) { printf(" Failed to unload foo\n");