Commit 8feb78ef authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: replace a magic constant with a define

parent d199591c
...@@ -319,7 +319,7 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, ...@@ -319,7 +319,7 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref,
TABLE_SHARE *share= tdc_acquire_share(thd, table_ref, GTS_TABLE | GTS_VIEW); TABLE_SHARE *share= tdc_acquire_share(thd, table_ref, GTS_TABLE | GTS_VIEW);
if (share == NULL) if (share == NULL)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
DBUG_ASSERT(share != (TABLE_SHARE*)1); DBUG_ASSERT(share != UNUSABLE_TABLE_SHARE);
versioned= share->versioned; versioned= share->versioned;
sequence= share->table_type == TABLE_TYPE_SEQUENCE; sequence= share->table_type == TABLE_TYPE_SEQUENCE;
......
...@@ -1025,6 +1025,8 @@ struct TABLE_SHARE ...@@ -1025,6 +1025,8 @@ struct TABLE_SHARE
void set_overlapped_keys(); void set_overlapped_keys();
}; };
/* not NULL, but cannot be dereferenced */
#define UNUSABLE_TABLE_SHARE ((TABLE_SHARE*)1)
/** /**
Class is used as a BLOB field value storage for Class is used as a BLOB field value storage for
......
...@@ -945,7 +945,7 @@ TABLE_SHARE *tdc_acquire_share(THD *thd, TABLE_LIST *tl, uint flags, ...@@ -945,7 +945,7 @@ TABLE_SHARE *tdc_acquire_share(THD *thd, TABLE_LIST *tl, uint flags,
table existed? table existed?
Let's return an invalid pointer here to catch dereferencing attempts. Let's return an invalid pointer here to catch dereferencing attempts.
*/ */
share= (TABLE_SHARE*) 1; share= UNUSABLE_TABLE_SHARE;
} }
DBUG_RETURN(share); DBUG_RETURN(share);
......
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