Skip to content

Commit

Permalink
cleanup - use guile's C interface to load modules when in C context
Browse files Browse the repository at this point in the history
That should be slightly more efficient than having it first
parse a string.
  • Loading branch information
gjanssens committed Dec 6, 2019
1 parent d52aa0a commit c1493c8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
12 changes: 2 additions & 10 deletions gnucash/gnome-utils/gncmod-gnome-utils.c
Expand Up @@ -56,22 +56,14 @@ libgncmod_gnome_utils_gnc_module_description(void)
return g_strdup("Utilities for using Gnome/Gtk with GnuCash");
}

static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
scm_c_eval_string(form);
g_free(form);
}

extern SCM scm_init_sw_gnome_utils_module(void);

int
libgncmod_gnome_utils_gnc_module_init(int refcount)
{
scm_init_sw_gnome_utils_module();
lmod("(sw_gnome_utils)");
lmod("(gnucash gnome-utils)");
scm_c_use_module ("sw_gnome_utils");
scm_c_use_module("gnucash gnome-utils");

/* Initialize the options-ui database */
if (refcount == 0)
Expand Down
11 changes: 1 addition & 10 deletions gnucash/html/gncmod-html.c
Expand Up @@ -60,23 +60,14 @@ libgncmod_html_gnc_module_description( void )
return g_strdup( "Utilities for using HTML with GnuCash" );
}

static void
lmod( char* mn )
{
char* form = g_strdup_printf( "(use-modules %s)\n", mn );
scm_c_eval_string( form );
g_free( form );
}

extern SCM scm_init_sw_gnc_html_module( void );

int
libgncmod_html_gnc_module_init( int refcount )
{
scm_init_sw_gnc_html_module();
gnc_html_initialize();
lmod( "(sw_gnc_html)" );
// lmod( "(gnucash gnc_html)" );
scm_c_use_module( "sw_gnc_html" );

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion gnucash/import-export/qif-imp/gncmod-qif-import.c
Expand Up @@ -76,7 +76,7 @@ libgncmod_qif_import_gnc_module_init(int refcount)
((void (*)())gnc_file_qif_import);
}

scm_c_eval_string("(use-modules (gnucash qif-import))");
scm_c_use_module("gnucash qif-import");

gnc_plugin_qif_import_create_plugin();

Expand Down
2 changes: 1 addition & 1 deletion gnucash/report/gncmod-report.c
Expand Up @@ -62,7 +62,7 @@ libgncmod_report_gnc_module_init(int refcount)
{
scm_init_sw_report_module();

scm_c_eval_string("(use-modules (gnucash report))");
scm_c_use_module ("gnucash report");

/* if this is the first time the module's being loaded, initialize
* the relative date system */
Expand Down

0 comments on commit c1493c8

Please sign in to comment.