1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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
This commit is contained in:
Sergey Vojtovich
2014-12-04 17:35:55 +04:00
parent 974808772b
commit 9127784d5c
4 changed files with 42 additions and 26 deletions

View File

@ -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,