From 7781a595d8236fe0cc6bd2f2fdd2d67c5707eb50 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Fri, 20 Sep 2013 21:54:01 +0700 Subject: modules: speed up multiple includes of the same module. * m4/module.c (m4_module_load): If we already have the module loaded, reuse that. Otherwise, open the module afresh and register it's builtins and macros on success. Signed-off-by: Gary V. Vaughan --- m4/module.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/m4/module.c b/m4/module.c index 05b7bdef..39cd2d23 100644 --- a/m4/module.c +++ b/m4/module.c @@ -214,13 +214,13 @@ install_macro_table (m4 *context, m4_module *module) m4_module * m4_module_load (m4 *context, const char *name, m4_obstack *obs) { - m4_module *module = m4__module_open (context, name, obs); - - if (module) + m4_module *module = m4__module_find (context, name); + + if (!module) { - const lt_dlinfo *info = lt_dlgetinfo (module->handle); + module = m4__module_open (context, name, obs); - if (info->ref_count == 1) + if (module) { install_builtin_table (context, module); install_macro_table (context, module); -- cgit v1.2.1