MDEV-6152: Remove calls to current_thd while creating Item

- Part 4: Removing calls to sql_alloc() and sql_calloc()

Other things:
- Added current_thd in some places to make it clear that it's called (easier to remove later)
- Move memory allocation from Item_func_case::fix_length_and_dec() to Item_func_case::fix_fields()
- Added mem_root to some new calls
- Fixed some wrong UNINIT_VAR() calls
- Fixed a bug in generate_partition_syntax() in case of errors
- Added mem_root to argument to new thread_info
- Simplified my_parse_error() call in sql_yacc.yy
This commit is contained in:
Monty 2015-08-27 10:07:32 +03:00
commit 3bca8db4f9
22 changed files with 296 additions and 253 deletions

View file

@ -404,7 +404,7 @@ bool Item_sum::collect_outer_ref_processor(uchar *param)
Item_sum::Item_sum(THD *thd, List<Item> &list): Item_func_or_sum(thd, list),
forced_const(FALSE)
{
if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count)))
if (!(orig_args= (Item **) thd->alloc(sizeof(Item *) * arg_count)))
{
args= NULL;
}
@ -3197,8 +3197,8 @@ Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
(for possible order items in temporary tables)
order - arg_count_order
*/
if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count * 2 +
sizeof(ORDER*)*arg_count_order)))
if (!(args= (Item**) thd->alloc(sizeof(Item*) * arg_count * 2 +
sizeof(ORDER*)*arg_count_order)))
return;
order= (ORDER**)(args + arg_count);