MCPcopy Create free account
hub / github.com/MariaDB/server / construct_options

Function construct_options

sql/sql_plugin.cc:3862–4122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3860*/
3861
3862static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
3863 my_option *options)
3864{
3865 const char *plugin_name= tmp->plugin->name;
3866 const LEX_CSTRING plugin_dash = { STRING_WITH_LEN("plugin-") };
3867 size_t plugin_name_len= strlen(plugin_name);
3868 size_t optnamelen;
3869 const int max_comment_len= 255;
3870 char *comment= static_cast<char*>(alloc_root(mem_root, max_comment_len + 1));
3871 char *optname;
3872
3873 int UNINIT_VAR(offset);
3874 st_mysql_sys_var *opt, **plugin_option;
3875 st_bookmark *v;
3876
3877 /** Used to circumvent the const attribute on my_option::name */
3878 char *plugin_name_ptr, *plugin_name_with_prefix_ptr;
3879
3880 DBUG_ENTER("construct_options");
3881
3882 plugin_name_ptr= static_cast<char*>(alloc_root(mem_root, plugin_name_len + 1));
3883 safe_strcpy(plugin_name_ptr, plugin_name_len + 1, plugin_name);
3884 my_casedn_str_latin1(plugin_name_ptr); // Plugin names are pure ASCII
3885 convert_underscore_to_dash(plugin_name_ptr, plugin_name_len);
3886 plugin_name_with_prefix_ptr= (char*) alloc_root(mem_root,
3887 plugin_name_len +
3888 plugin_dash.length + 1);
3889 strxmov(plugin_name_with_prefix_ptr, plugin_dash.str, plugin_name_ptr, NullS);
3890
3891 if (!plugin_is_forced(tmp))
3892 {
3893 /* support --skip-plugin-foo syntax */
3894 options[0].name= plugin_name_ptr;
3895 options[1].name= plugin_name_with_prefix_ptr;
3896 options[0].id= options[1].id= 0;
3897 options[0].var_type= options[1].var_type= GET_ENUM;
3898 options[0].arg_type= options[1].arg_type= OPT_ARG;
3899 options[0].def_value= options[1].def_value= 1; /* ON */
3900 options[0].typelib= options[1].typelib= &global_plugin_typelib;
3901
3902 strxnmov(comment, max_comment_len, "Enable or disable ", plugin_name,
3903 " plugin. One of: ON, OFF, FORCE (don't start if the plugin"
3904 " fails to load), FORCE_PLUS_PERMANENT (like FORCE, but the"
3905 " plugin can not be uninstalled).", NullS);
3906 options[0].comment= comment;
3907 /*
3908 Allocate temporary space for the value of the tristate.
3909 This option will have a limited lifetime and is not used beyond
3910 server initialization.
3911 GET_ENUM value is an unsigned long integer.
3912 */
3913 options[0].value= options[1].value=
3914 (uchar **)alloc_root(mem_root, sizeof(ulong));
3915 *((ulong*) options[0].value)= (ulong) options[0].def_value;
3916
3917 options+= 2;
3918 }
3919

Callers 2

construct_help_optionsFunction · 0.85
test_plugin_optionsFunction · 0.85

Calls 15

alloc_rootFunction · 0.85
safe_strcpyFunction · 0.85
my_casedn_str_latin1Function · 0.85
strxmovFunction · 0.85
plugin_is_forcedFunction · 0.85
strxnmovFunction · 0.85
register_varFunction · 0.85
find_bookmarkFunction · 0.85
var_def_ptrFunction · 0.85
my_freeFunction · 0.85
my_strdupFunction · 0.85

Tested by 1

test_plugin_optionsFunction · 0.68