summaryrefslogtreecommitdiff
path: root/sql/sql_array.h
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-12-04 17:35:55 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-12-05 11:01:50 +0400
commit9127784d5ce845c9d66a34eee371cbaf82468d89 (patch)
treece1b583eb90d483665db97c1a13335ae4a326e0c /sql/sql_array.h
parent974808772b63563d031f687fd0fd158f83eb94aa (diff)
downloadmariadb-git-9127784d5ce845c9d66a34eee371cbaf82468d89.tar.gz
Cherry pick dynamic array changes from commit:
commit 85fd3d901311688e18ffce92ffc78129e5625791 Author: Monty <monty@mariadb.org> Date: Fri Aug 29 14:07:43 2014 +0300 my_alloc.c - Changed 0x%lx -> %p array.c: - Static (preallocated) buffer can now be anywhere my_sys.h - Define MY_INIT_BUFFER_USED sql_delete.cc & sql_lex.cc - Use memroot when allocating classes (avoids call to current_thd) sql_explain.h: - Use preallocated buffers sql_explain.cc: - Use preallocated buffers and memroot sql_select.cc: - Use multi_alloc_root() instead of many alloc_root() - Update calls to Explain
Diffstat (limited to 'sql/sql_array.h')
-rw-r--r--sql/sql_array.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 8202e94ce41..da95e99daa4 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -105,6 +105,13 @@ public:
init(prealloc, increment);
}
+ Dynamic_array(MEM_ROOT *root, uint prealloc=16, uint increment=16)
+ {
+ void *init_buffer= alloc_root(root, sizeof(Elem) * prealloc);
+ my_init_dynamic_array2(&array, sizeof(Elem), init_buffer,
+ prealloc, increment, MYF(0));
+ }
+
void init(uint prealloc=16, uint increment=16)
{
my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment,