summaryrefslogtreecommitdiff
path: root/sql/temporary_tables.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-12-16 18:22:35 +0100
committerSergei Golubchik <serg@mariadb.org>2018-12-20 08:06:55 +0100
commitd13302ff6013acee9ac5fb6946d0c91e2f303224 (patch)
treeec767457ab0b2d84c308117e6a09c6cd24a0e0ea /sql/temporary_tables.cc
parent2ec018b281a801089afde96ec0f5968c8ed89858 (diff)
downloadmariadb-git-d13302ff6013acee9ac5fb6946d0c91e2f303224.tar.gz
cleanup: small simplification
Diffstat (limited to 'sql/temporary_tables.cc')
-rw-r--r--sql/temporary_tables.cc32
1 files changed, 7 insertions, 25 deletions
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 87c4671ada4..a4ece127f96 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -1032,39 +1032,21 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length,
/* A matching TMP_TABLE_SHARE is found. */
All_share_tables_list::Iterator tables_it(share->all_tmp_tables);
- while ((table= tables_it++))
+ bool found= false;
+ while (!found && (table= tables_it++))
{
switch (state)
{
- case TMP_TABLE_IN_USE:
- if (table->query_id > 0)
- {
- result= table;
- goto done;
- }
- break;
- case TMP_TABLE_NOT_IN_USE:
- if (table->query_id == 0)
- {
- result= table;
- goto done;
- }
- break;
- case TMP_TABLE_ANY:
- {
- result= table;
- goto done;
- }
- break;
- default: /* Invalid */
- DBUG_ASSERT(0);
- goto done;
+ case TMP_TABLE_IN_USE: found= table->query_id > 0; break;
+ case TMP_TABLE_NOT_IN_USE: found= table->query_id == 0; break;
+ case TMP_TABLE_ANY: found= true; break;
}
}
+ result= table;
+ break;
}
}
-done:
if (locked)
{
DBUG_ASSERT(m_tmp_tables_locked);