1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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
parent 3cb578c001
commit 3bca8db4f9
22 changed files with 296 additions and 253 deletions

View File

@ -2333,10 +2333,8 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff)
class thread_info :public ilink {
public:
static void *operator new(size_t size)
{
return (void*) sql_alloc((uint) size);
}
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr __attribute__((unused)),
size_t size __attribute__((unused)))
{ TRASH(ptr, size); }
@ -2440,7 +2438,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
(!user || (!tmp->system_thread &&
tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
{
thread_info *thd_info= new thread_info;
thread_info *thd_info= new (thd->mem_root) thread_info;
thd_info->thread_id=tmp->thread_id;
thd_info->user= thd->strdup(tmp_sctx->user ? tmp_sctx->user :