@@ -316,6 +316,12 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin);
316
316
static void intern_plugin_unlock (LEX *lex, plugin_ref plugin);
317
317
static void reap_plugins (void );
318
318
319
+ bool plugin_is_forced (struct st_plugin_int *p)
320
+ {
321
+ return p->load_option == PLUGIN_FORCE ||
322
+ p->load_option == PLUGIN_FORCE_PLUS_PERMANENT;
323
+ }
324
+
319
325
static void report_error (int where_to, uint error, ...)
320
326
{
321
327
va_list args;
@@ -1657,8 +1663,7 @@ int plugin_init(int *argc, char **argv, int flags)
1657
1663
while ((plugin_ptr= *(--reap)))
1658
1664
{
1659
1665
mysql_mutex_unlock (&LOCK_plugin);
1660
- if (plugin_ptr->load_option == PLUGIN_FORCE ||
1661
- plugin_ptr->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
1666
+ if (plugin_is_forced (plugin_ptr))
1662
1667
reaped_mandatory_plugin= TRUE ;
1663
1668
plugin_deinitialize (plugin_ptr, true );
1664
1669
mysql_mutex_lock (&LOCK_plugin);
@@ -3505,8 +3510,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
3505
3510
plugin_dash.length + 1 );
3506
3511
strxmov (plugin_name_with_prefix_ptr, plugin_dash.str , plugin_name_ptr, NullS);
3507
3512
3508
- if (tmp->load_option != PLUGIN_FORCE &&
3509
- tmp->load_option != PLUGIN_FORCE_PLUS_PERMANENT)
3513
+ if (!plugin_is_forced (tmp))
3510
3514
{
3511
3515
/* support --skip-plugin-foo syntax */
3512
3516
options[0 ].name = plugin_name_ptr;
@@ -3823,8 +3827,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
3823
3827
We adjust the default value to account for the hardcoded exceptions
3824
3828
we have set for the federated and ndbcluster storage engines.
3825
3829
*/
3826
- if (tmp->load_option != PLUGIN_FORCE &&
3827
- tmp->load_option != PLUGIN_FORCE_PLUS_PERMANENT)
3830
+ if (!plugin_is_forced (tmp))
3828
3831
opts[0 ].def_value = opts[1 ].def_value = plugin_load_option;
3829
3832
3830
3833
error= handle_options (argc, &argv, opts, NULL );
@@ -3840,8 +3843,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
3840
3843
Set plugin loading policy from option value. First element in the option
3841
3844
list is always the <plugin name> option value.
3842
3845
*/
3843
- if (tmp->load_option != PLUGIN_FORCE &&
3844
- tmp->load_option != PLUGIN_FORCE_PLUS_PERMANENT)
3846
+ if (!plugin_is_forced (tmp))
3845
3847
plugin_load_option= (enum_plugin_load_option) *(ulong*) opts[0 ].value ;
3846
3848
}
3847
3849
0 commit comments