diff options
author | Monty <monty@mariadb.org> | 2015-08-20 15:24:13 +0300 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-21 10:40:51 +0400 |
commit | 1bae0d9e5669c2d03209082142e892417e24d09a (patch) | |
tree | 8702469bab1f515c78a06ede07ae4aeaa297c802 /storage | |
parent | 31e365efae28ba3208e80511c4d18fe11a79541a (diff) | |
download | mariadb-git-1bae0d9e5669c2d03209082142e892417e24d09a.tar.gz |
Stage 2 of MDEV-6152:
- Added mem_root to all calls to new Item
- Added private method operator new(size_t size) to Item to ensure that
we always use a mem_root when creating an item.
This saves use once call to current_thd per Item creation
Diffstat (limited to 'storage')
-rw-r--r-- | storage/sphinx/ha_sphinx.cc | 5 | ||||
-rw-r--r-- | storage/spider/spd_sys_table.cc | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 25cedf3547b..568d3695781 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -2335,10 +2335,11 @@ int ha_sphinx::write_row ( byte * ) } else { + THD *thd= ha_thd(); if ( (*ppField)->type()==MYSQL_TYPE_TIMESTAMP ) { - Item_field * pWrap = new Item_field ( ha_thd(), *ppField ); // autofreed by query arena, I assume - Item_func_unix_timestamp * pConv = new Item_func_unix_timestamp ( ha_thd(), pWrap ); + Item_field * pWrap = new (thd->mem_root) Item_field(thd, *ppField); // autofreed by query arena, I assume + Item_func_unix_timestamp * pConv = new (thd->mem_root) Item_func_unix_timestamp(thd, pWrap); pConv->quick_fix_field(); unsigned int uTs = (unsigned int) pConv->val_int(); diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 7b996383f95..15d0c43a176 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -2390,7 +2390,7 @@ TABLE *spider_mk_sys_tmp_table( goto error_alloc_field; field->init(table); - if (!(i_field = new Item_field(thd, (Field *) field))) + if (!(i_field = new (thd->mem_root) Item_field(thd, (Field *) field))) goto error_alloc_item_field; if (i_list.push_back(i_field)) @@ -2443,29 +2443,29 @@ TABLE *spider_mk_sys_tmp_table_for_result( goto error_alloc_field1; field1->init(table); - if (!(i_field1 = new Item_field(thd, (Field *) field1))) + if (!(i_field1 = new (thd->mem_root) Item_field(thd, (Field *) field1))) goto error_alloc_item_field1; if (i_list.push_back(i_field1)) goto error_push_item1; - if (!(field2 = new Field_blob( + if (!(field2 = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name2, cs, TRUE))) goto error_alloc_field2; field2->init(table); - if (!(i_field2 = new Item_field(thd, (Field *) field2))) + if (!(i_field2 = new (thd->mem_root) Item_field(thd, (Field *) field2))) goto error_alloc_item_field2; if (i_list.push_back(i_field2)) goto error_push_item2; - if (!(field3 = new Field_blob( + if (!(field3 = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name3, cs, TRUE))) goto error_alloc_field3; field3->init(table); - if (!(i_field3 = new Item_field(thd, (Field *) field3))) + if (!(i_field3 = new (thd->mem_root) Item_field(thd, (Field *) field3))) goto error_alloc_item_field3; if (i_list.push_back(i_field3)) |