remove casts. uchar can store 1/0 as good as bool.
This commit is contained in:
Sergei Golubchik 2022-11-17 20:03:33 +01:00
parent 1e6ad0ce13
commit df82d68421
2 changed files with 10 additions and 12 deletions

View File

@ -7225,7 +7225,7 @@ bool Item_null::send(Protocol *protocol, st_value *buffer)
bool Item::cache_const_expr_analyzer(uchar **arg)
{
bool *cache_flag= (bool*)*arg;
uchar *cache_flag= *arg;
if (!*cache_flag)
{
Item *item= real_item();
@ -7264,9 +7264,9 @@ bool Item::cache_const_expr_analyzer(uchar **arg)
Item* Item::cache_const_expr_transformer(THD *thd, uchar *arg)
{
if (*(bool*)arg)
if (*arg)
{
*((bool*)arg)= FALSE;
*arg= FALSE;
Item_cache *cache= get_cache(thd);
if (!cache)
return NULL;

View File

@ -28287,20 +28287,20 @@ JOIN::reoptimize(Item *added_where, table_map join_tables,
void JOIN::cache_const_exprs()
{
bool cache_flag= FALSE;
bool *analyzer_arg= &cache_flag;
uchar cache_flag= FALSE;
uchar *analyzer_arg= &cache_flag;
/* No need in cache if all tables are constant. */
if (const_tables == table_count)
return;
if (conds)
conds->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
conds->compile(thd, &Item::cache_const_expr_analyzer, &analyzer_arg,
&Item::cache_const_expr_transformer, &cache_flag);
cache_flag= FALSE;
if (having)
having->compile(thd, &Item::cache_const_expr_analyzer, (uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer, (uchar *)&cache_flag);
having->compile(thd, &Item::cache_const_expr_analyzer,
&analyzer_arg, &Item::cache_const_expr_transformer, &cache_flag);
for (JOIN_TAB *tab= first_depth_first_tab(this); tab;
tab= next_depth_first_tab(this, tab))
@ -28309,9 +28309,7 @@ void JOIN::cache_const_exprs()
{
cache_flag= FALSE;
(*tab->on_expr_ref)->compile(thd, &Item::cache_const_expr_analyzer,
(uchar **)&analyzer_arg,
&Item::cache_const_expr_transformer,
(uchar *)&cache_flag);
&analyzer_arg, &Item::cache_const_expr_transformer, &cache_flag);
}
}
}