1
/*****************************************************************************
3
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
21
The dynamically allocated array
23
Created 2/5/1996 Heikki Tuuri
24
*******************************************************/
31
/************************************************************//**
32
Adds a new block to a dyn array.
33
@return created block */
38
dyn_array_t* arr) /*!< in: dyn array */
44
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
46
if (arr->heap == NULL) {
47
UT_LIST_INIT(arr->base);
48
UT_LIST_ADD_FIRST(list, arr->base, arr);
50
arr->heap = mem_heap_create(sizeof(dyn_block_t));
53
block = dyn_array_get_last_block(arr);
54
block->used = block->used | DYN_BLOCK_FULL_FLAG;
58
block = mem_heap_alloc(heap, sizeof(dyn_block_t));
62
UT_LIST_ADD_LAST(list, arr->base, block);