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 */
| 3009 | LOCK_system_variables_hash should be at least read locked |
| 3010 | */ |
| 3011 | static 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 | |
| 3047 | static size_t var_storage_size(int flags) |