Commit 06a8412b authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: plugin unload

* reduce code duplication
parent 3050d5e8
...@@ -1263,23 +1263,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check) ...@@ -1263,23 +1263,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
remove_status_vars(show_vars); remove_status_vars(show_vars);
} }
if (plugin_type_deinitialize[plugin->plugin->type]) plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type];
{ if (!deinit)
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin)) deinit= (plugin_type_init)(plugin->plugin->deinit);
if (deinit && deinit(plugin))
{ {
sql_print_error("Plugin '%s' of type %s failed deinitialization", sql_print_error("Plugin '%s' of type %s failed deinitialization",
plugin->name.str, plugin_type_names[plugin->plugin->type].str); plugin->name.str, plugin_type_names[plugin->plugin->type].str);
} }
}
else if (plugin->plugin->deinit)
{
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
if (plugin->plugin->deinit(plugin))
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
}
plugin->state= PLUGIN_IS_UNINITIALIZED; plugin->state= PLUGIN_IS_UNINITIALIZED;
if (ref_check && plugin->ref_count) if (ref_check && plugin->ref_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment