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

Function test_plugin_options

sql/sql_plugin.cc:4202–4404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4200*/
4201
4202static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
4203 int *argc, char **argv)
4204{
4205 struct sys_var_chain chain= { NULL, NULL };
4206 bool disable_plugin= false;
4207 enum_plugin_load_option plugin_load_option= tmp->load_option;
4208
4209 MEM_ROOT *mem_root= alloc_root_inited(&tmp->mem_root) ?
4210 &tmp->mem_root : &plugin_vars_mem_root;
4211 st_mysql_sys_var **opt;
4212 my_option *opts= NULL;
4213 int error= 1;
4214 struct st_bookmark *var;
4215 size_t len=0, count= EXTRA_OPTIONS;
4216 st_ptr_backup *tmp_backup= 0;
4217 const char *plugin_name= tmp->plugin->name;
4218 size_t plugin_name_len= strlen(plugin_name);
4219 DBUG_ENTER("test_plugin_options");
4220 DBUG_ASSERT(tmp->plugin && tmp->name.str);
4221
4222 char *plugin_name_ptr= static_cast<char*>(alloc_root(mem_root, plugin_name_len + 1));
4223 safe_strcpy(plugin_name_ptr, plugin_name_len + 1, plugin_name);
4224 my_casedn_str_latin1(plugin_name_ptr);
4225 if (tmp->plugin->system_vars || (*argc > 1))
4226 {
4227 for (opt= tmp->plugin->system_vars; opt && *opt; opt++)
4228 {
4229 len++;
4230 if (!((*opt)->flags & PLUGIN_VAR_NOCMDOPT))
4231 count+= 2; /* --{plugin}-{optname} and --plugin-{plugin}-{optname} */
4232 }
4233
4234 if (!(opts= (my_option*) alloc_root(tmp_root, sizeof(my_option) * count)))
4235 {
4236 sql_print_error("Out of memory for plugin '%s'.", tmp->name.str);
4237 DBUG_RETURN(-1);
4238 }
4239 bzero(opts, sizeof(my_option) * count);
4240
4241 if (construct_options(tmp_root, tmp, opts))
4242 {
4243 sql_print_error("Bad options for plugin '%s'.", tmp->name.str);
4244 DBUG_RETURN(-1);
4245 }
4246
4247 if (tmp->plugin->system_vars)
4248 {
4249 tmp_backup= (st_ptr_backup *)my_alloca(len * sizeof(tmp_backup[0]));
4250 DBUG_ASSERT(tmp->nbackups == 0);
4251 DBUG_ASSERT(tmp->ptr_backup == 0);
4252
4253 for (opt= tmp->plugin->system_vars; *opt; opt++)
4254 {
4255 st_mysql_sys_var *o= *opt;
4256 char *varname;
4257 sys_var *v;
4258
4259 tmp_backup[tmp->nbackups++].save(&o->name);

Callers 1

plugin_initializeFunction · 0.85

Calls 15

alloc_rootFunction · 0.85
safe_strcpyFunction · 0.85
my_casedn_str_latin1Function · 0.85
construct_optionsFunction · 0.85
find_bookmarkFunction · 0.85
strxmovFunction · 0.85
restore_ptr_backupFunction · 0.85
plugin_is_forcedFunction · 0.85
handle_optionsFunction · 0.85
strdup_rootFunction · 0.85
mysql_add_sys_var_chainFunction · 0.85
my_cleanup_optionsFunction · 0.85

Tested by

no test coverage detected