diff options
author | Gary V. Vaughan <gary@gnu.org> | 2013-09-20 17:26:42 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2013-09-20 21:41:58 +0700 |
commit | 1d0cc3149668703ee990fdd562582dccc73c8864 (patch) | |
tree | 9ad04620a6f606622706f83fda65df71e4fea34b | |
parent | b466ccc6137f2255220c87f74baf86a67884a3d8 (diff) | |
download | m4-1d0cc3149668703ee990fdd562582dccc73c8864.tar.gz |
modules: store module name in the module struct.
* m4/m4private.h (m4_module): Add name field.
* m4/module.c (m4__module_open): Save the name field.
* m4/path.c (m4_load_filename): Pass the raw filename to
m4_module_load.
* m4/module.c (m4_get_module_name): Replace all the ltdl
twiddling with returning the saved name field.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
-rw-r--r-- | m4/m4private.h | 1 | ||||
-rw-r--r-- | m4/module.c | 14 | ||||
-rw-r--r-- | m4/path.c | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/m4/m4private.h b/m4/m4private.h index 35957223..916330ca 100644 --- a/m4/m4private.h +++ b/m4/m4private.h @@ -178,6 +178,7 @@ extern void m4__builtin_print (m4_obstack *, const m4__builtin *, bool, /* Representation of a loaded m4 module. */ struct m4_module { + const char *name; /* Name of the module. */ lt_dlhandle handle; /* All ltdl module information. */ m4__builtin *builtins; /* Sorted array of builtins. */ m4_macro *macros; /* Unsorted array of macros. */ diff --git a/m4/module.c b/m4/module.c index a2215f0e..db26198a 100644 --- a/m4/module.c +++ b/m4/module.c @@ -79,13 +79,8 @@ static lt_dlinterface_id iface_id = NULL; const char * m4_get_module_name (const m4_module *module) { - const lt_dlinfo *info; - - assert (module && module->handle); - - info = lt_dlgetinfo (module->handle); - - return info ? info->name : NULL; + assert (module); + return module->name; } void * @@ -212,7 +207,7 @@ install_macro_table (m4 *context, m4_module *module) m4_debug_message (context, M4_DEBUG_TRACE_MODULE, _("module %s: macros loaded"), - m4_get_module_name (module)); + m4_get_module_name (module)); } } @@ -229,7 +224,7 @@ m4_module_load (m4 *context, const char *name, m4_obstack *obs) { install_builtin_table (context, module); install_macro_table (context, module); - } + } } return module; @@ -417,6 +412,7 @@ m4__module_open (m4 *context, const char *name, m4_obstack *obs) const char *err; module = (m4_module *) xzalloc (sizeof *module); + module->name = xstrdup (name); module->handle = handle; /* clear out any stale errors, since we have to use @@ -299,7 +299,7 @@ m4_load_filename (m4 *context, const m4_call_info *caller, && suffix && (STREQ (suffix, LT_MODULE_EXT) || STREQ (suffix, ".la"))) { - m4_module_load (context, filepath, obs); + m4_module_load (context, filename, obs); } else { |