drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
dyn0dyn.cc
1/*****************************************************************************
2
3Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
26#include "dyn0dyn.h"
27#ifdef UNIV_NONINL
28#include "dyn0dyn.ic"
29#endif
30
31/************************************************************/
34UNIV_INTERN
36dyn_array_add_block(
37/*================*/
38 dyn_array_t* arr)
39{
40 mem_heap_t* heap;
41 dyn_block_t* block;
42
43 ut_ad(arr);
44 ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
45
46 if (arr->heap == NULL) {
47 UT_LIST_INIT(arr->base);
48 UT_LIST_ADD_FIRST(list, arr->base, arr);
49
50 arr->heap = mem_heap_create(sizeof(dyn_block_t));
51 }
52
53 block = dyn_array_get_last_block(arr);
54 block->used = block->used | DYN_BLOCK_FULL_FLAG;
55
56 heap = arr->heap;
57
58 block = static_cast<dyn_block_t *>(mem_heap_alloc(heap, sizeof(dyn_block_t)));
59
60 block->used = 0;
61
62 UT_LIST_ADD_LAST(list, arr->base, block);
63
64 return(block);
65}
struct dyn_block_struct dyn_block_t
Definition dyn0dyn.h:35
dyn_block_t dyn_array_t
Definition dyn0dyn.h:37
UNIV_INLINE dyn_block_t * dyn_array_get_last_block(dyn_array_t *arr)
#define mem_heap_create(N)
Definition mem0mem.h:91
UNIV_INLINE void * mem_heap_alloc(mem_heap_t *heap, ulint n)
mem_heap_t * heap
Definition dyn0dyn.h:164
#define ut_ad(EXPR)
Definition ut0dbg.h:127
#define UT_LIST_ADD_LAST(NAME, BASE, N)
Definition ut0lst.h:118
#define UT_LIST_ADD_FIRST(NAME, BASE, N)
Definition ut0lst.h:96
#define UT_LIST_INIT(BASE)
Definition ut0lst.h:83