diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-09 02:35:05 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-09 05:01:50 +0100 |
commit | aca153f5750cabfb7ccf0fc0cb5a05a83ed2d026 (patch) | |
tree | 547b098ab0feb39dbaf4bbf32d3cb8e67dcb7253 /degesch.c | |
parent | 79f46752d465680ff50fda38a007998673f3f746 (diff) | |
download | xK-aca153f5750cabfb7ccf0fc0cb5a05a83ed2d026.tar.gz xK-aca153f5750cabfb7ccf0fc0cb5a05a83ed2d026.tar.xz xK-aca153f5750cabfb7ccf0fc0cb5a05a83ed2d026.zip |
degesch: Lua: fix configuration loading
Not the cleanest solution but it has to do for now.
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -7999,10 +7999,12 @@ lua_plugin_add_config_schema (struct lua_plugin *plugin, self->ref_validate = LUA_REFNIL; struct config_schema *schema = &self->schema; - schema->name = xstrdup (name); - schema->comment = NULL; - schema->default_ = NULL; - schema->type = CONFIG_ITEM_NULL; + schema->name = xstrdup (name); + schema->comment = NULL; + schema->default_ = NULL; + schema->type = CONFIG_ITEM_NULL; + schema->on_change = lua_schema_item_on_change; + schema->validate = lua_schema_item_validate; // Try to update the defaults with values provided by the plugin int values = lua_absindex (L, -2); @@ -8602,7 +8604,7 @@ lua_plugin_load (struct app_context *ctx, const char *filename, luaL_openlibs (L); struct lua_plugin *plugin = xcalloc (1, sizeof *plugin); - plugin->super.name = NULL; + plugin->super.name = xstrdup (filename); plugin->super.vtable = &lua_plugin_vtable; plugin->ctx = ctx; plugin->L = L; @@ -8714,9 +8716,12 @@ plugin_load (struct app_context *ctx, const char *name) struct plugin *plugin = plugin_load_by_name (ctx, name, &e); if (plugin) { + // FIXME: this way the real name isn't available to the plugin on load + free (plugin->name); + plugin->name = xstrdup (name); + log_global_status (ctx, "Plugin \"#s\" loaded", name); LIST_PREPEND (ctx->plugins, plugin); - plugin->name = xstrdup (name); } else { |