diff options
author | Gary V. Vaughan <gary@gnu.org> | 2013-09-20 21:54:01 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2013-09-20 21:54:01 +0700 |
commit | 7781a595d8236fe0cc6bd2f2fdd2d67c5707eb50 (patch) | |
tree | efaee266eb78d7672265fcdb085cf7b5173bf3a9 | |
parent | 7b5142a2fd0939e5209e1d375843b8e9d94eb114 (diff) | |
download | m4-7781a595d8236fe0cc6bd2f2fdd2d67c5707eb50.tar.gz |
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 <gary@gnu.org>
-rw-r--r-- | m4/module.c | 10 |
1 files 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); |