Commit 2c00379d authored by unknown's avatar unknown

Merge pilot.mysql.com:/home/msvensson/mysql/my51-ndb-gca-my51-m

into  pilot.mysql.com:/home/msvensson/mysql/mysql-5.1-new-ndb


sql/sql_plugin.cc:
  Auto merged
parents 7baaa781 eec509bd
...@@ -951,29 +951,30 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, ...@@ -951,29 +951,30 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
state_mask= ~state_mask; // do it only once state_mask= ~state_mask; // do it only once
rw_rdlock(&THR_LOCK_plugin); rw_rdlock(&THR_LOCK_plugin);
total= type == MYSQL_ANY_PLUGIN ? plugin_array.elements
: plugin_hash[type].records;
/*
Do the alloca out here in case we do have a working alloca:
leaving the nested stack frame invalidates alloca allocation.
*/
plugins=(struct st_plugin_int **)my_alloca(total*sizeof(*plugins));
if (type == MYSQL_ANY_PLUGIN) if (type == MYSQL_ANY_PLUGIN)
{ {
total=plugin_array.elements;
plugins=(struct st_plugin_int **)my_alloca(total*sizeof(*plugins));
for (idx= 0; idx < total; idx++) for (idx= 0; idx < total; idx++)
{ {
plugin= dynamic_element(&plugin_array, idx, struct st_plugin_int *); plugin= dynamic_element(&plugin_array, idx, struct st_plugin_int *);
if (plugin->state & state_mask) plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
continue;
plugins[idx]= plugin;
} }
} }
else else
{ {
HASH *hash= &plugin_hash[type]; HASH *hash= plugin_hash + type;
total=hash->records;
plugins=(struct st_plugin_int **)my_alloca(total*sizeof(*plugins));
for (idx= 0; idx < total; idx++) for (idx= 0; idx < total; idx++)
{ {
plugin= (struct st_plugin_int *) hash_element(hash, idx); plugin= (struct st_plugin_int *) hash_element(hash, idx);
if (plugin->state & state_mask) if (plugin->state & state_mask)
continue; continue;
plugins[idx]= plugin; plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
} }
} }
rw_unlock(&THR_LOCK_plugin); rw_unlock(&THR_LOCK_plugin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment