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

Function find_bookmark

sql/sql_plugin.cc:3011–3044  ·  view source on GitHub ↗

called by register_var, construct_options and test_plugin_options. Returns the 'bookmark' for the named variable. returns null for non thd-local variables. LOCK_system_variables_hash should be at least read locked */

Source from the content-addressed store, hash-verified

3009 LOCK_system_variables_hash should be at least read locked
3010*/
3011static st_bookmark *find_bookmark(const char *plugin, const char *name,
3012 int flags)
3013{
3014 st_bookmark *result= NULL;
3015 size_t namelen, length, pluginlen= 0;
3016 char *varname, *p;
3017
3018 if (!(flags & PLUGIN_VAR_THDLOCAL))
3019 return NULL;
3020
3021 namelen= strlen(name);
3022 if (plugin)
3023 pluginlen= strlen(plugin) + 1;
3024 length= namelen + pluginlen + 2;
3025 varname= (char*) my_alloca(length);
3026
3027 if (plugin)
3028 {
3029 strxmov(varname + 1, plugin, "_", name, NullS);
3030 for (p= varname + 1; *p; p++)
3031 if (*p == '-')
3032 *p= '_';
3033 }
3034 else
3035 memcpy(varname + 1, name, namelen + 1);
3036
3037 varname[0]= plugin_var_bookmark_key(flags);
3038
3039 result= (st_bookmark*) my_hash_search(&bookmark_hash,
3040 (const uchar*) varname, length - 1);
3041
3042 my_afree(varname);
3043 return result;
3044}
3045
3046
3047static size_t var_storage_size(int flags)

Callers 4

register_varFunction · 0.85
plugin_vars_free_valuesFunction · 0.85
construct_optionsFunction · 0.85
test_plugin_optionsFunction · 0.85

Calls 3

strxmovFunction · 0.85
plugin_var_bookmark_keyFunction · 0.85
my_hash_searchFunction · 0.85

Tested by 1

test_plugin_optionsFunction · 0.68