Skip to content

Commit 06a8412

Browse files
committed
cleanup: plugin unload
* reduce code duplication
1 parent 3050d5e commit 06a8412

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

sql/sql_plugin.cc

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,23 +1263,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
12631263
remove_status_vars(show_vars);
12641264
}
12651265

1266-
if (plugin_type_deinitialize[plugin->plugin->type])
1267-
{
1268-
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
1269-
{
1270-
sql_print_error("Plugin '%s' of type %s failed deinitialization",
1271-
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
1272-
}
1273-
}
1274-
else if (plugin->plugin->deinit)
1266+
plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type];
1267+
if (!deinit)
1268+
deinit= (plugin_type_init)(plugin->plugin->deinit);
1269+
1270+
if (deinit && deinit(plugin))
12751271
{
1276-
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
1277-
if (plugin->plugin->deinit(plugin))
1278-
{
1279-
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
1280-
plugin->name.str));
1281-
}
1272+
sql_print_error("Plugin '%s' of type %s failed deinitialization",
1273+
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
12821274
}
1275+
12831276
plugin->state= PLUGIN_IS_UNINITIALIZED;
12841277

12851278
if (ref_check && plugin->ref_count)
@@ -1341,7 +1334,7 @@ static void reap_plugins(void)
13411334

13421335
list= reap;
13431336
while ((plugin= *(--list)))
1344-
plugin_deinitialize(plugin, true);
1337+
plugin_deinitialize(plugin, true);
13451338

13461339
mysql_mutex_lock(&LOCK_plugin);
13471340

@@ -2354,7 +2347,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
23542347
of the delete from the plugin table, so that it is not replicated in
23552348
row based mode.
23562349
*/
2357-
table->file->row_logging= 0; // No logging
2350+
table->file->row_logging= 0; // No logging
23582351
error= table->file->ha_delete_row(table->record[0]);
23592352
if (unlikely(error))
23602353
{
@@ -4409,7 +4402,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value)
44094402
DBUG_ASSERT(key != INVALID_THD_KEY);
44104403
if (key == INVALID_THD_KEY || (!thd && !(thd= current_thd)))
44114404
return EINVAL;
4412-
4405+
44134406
memcpy(intern_sys_var_ptr(thd, key, true), &value, sizeof(void*));
44144407
return 0;
44154408
}

0 commit comments

Comments
 (0)