summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2006-11-12 14:15:01 +0100
committerunknown <istruewing@chilla.local>2006-11-12 14:15:01 +0100
commit9ec9268b718db06f55a0fb8364b42b6013a5b25f (patch)
tree6adc5da5cb1a2a0f07ece6a4b3e4a820b82177ee /sql/sql_plugin.cc
parent47bdda0b9d94c1ad0808e50c73a429f93f2416d2 (diff)
parent10a61ed5a909c569429259c8853446a5fe52eefa (diff)
downloadmariadb-git-9ec9268b718db06f55a0fb8364b42b6013a5b25f.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into chilla.local:/home/mydev/mysql-5.1-axmrg BitKeeper/deleted/.del-CMakeLists.txt~1: Auto merged BitKeeper/deleted/.del-make_win_bin_dist: Auto merged configure.in: Auto merged include/mysql.h: Auto merged libmysqld/lib_sql.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_plugin.cc: Auto merged
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 7a0a143dcc9..4d2fe83755f 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -944,29 +944,28 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
state_mask= ~state_mask; // do it only once
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)
{
- total=plugin_array.elements;
- plugins=(struct st_plugin_int **)my_alloca(total*sizeof(*plugins));
for (idx= 0; idx < total; idx++)
{
plugin= dynamic_element(&plugin_array, idx, struct st_plugin_int *);
- if (plugin->state & state_mask)
- continue;
- plugins[idx]= plugin;
+ plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
}
}
else
{
- HASH *hash= &plugin_hash[type];
- total=hash->records;
- plugins=(struct st_plugin_int **)my_alloca(total*sizeof(*plugins));
+ HASH *hash= plugin_hash + type;
for (idx= 0; idx < total; idx++)
{
plugin= (struct st_plugin_int *) hash_element(hash, idx);
- if (plugin->state & state_mask)
- continue;
- plugins[idx]= plugin;
+ plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
}
}
rw_unlock(&THR_LOCK_plugin);