~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/dyn/dyn0dyn.c

  • Committer: Brian Aker
  • Date: 2010-02-07 01:33:54 UTC
  • Revision ID: brian@gaz-20100207013354-d2pg1n68u5c09pgo
Remove giant include header to its own file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************
2
 
The dynamically allocated array
3
 
 
4
 
(c) 1996 Innobase Oy
5
 
 
6
 
Created 2/5/1996 Heikki Tuuri
7
 
*******************************************************/
8
 
 
9
 
#include "dyn0dyn.h"
10
 
#ifdef UNIV_NONINL
11
 
#include "dyn0dyn.ic"
12
 
#endif
13
 
 
14
 
/****************************************************************
15
 
Adds a new block to a dyn array. */
16
 
 
17
 
dyn_block_t*
18
 
dyn_array_add_block(
19
 
/*================*/
20
 
                                /* out: created block */
21
 
        dyn_array_t*    arr)    /* in: dyn array */
22
 
{
23
 
        mem_heap_t*     heap;
24
 
        dyn_block_t*    block;
25
 
 
26
 
        ut_ad(arr);
27
 
        ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
28
 
 
29
 
        if (arr->heap == NULL) {
30
 
                UT_LIST_INIT(arr->base);
31
 
                UT_LIST_ADD_FIRST(list, arr->base, arr);
32
 
 
33
 
                arr->heap = mem_heap_create(sizeof(dyn_block_t));
34
 
        }
35
 
 
36
 
        block = dyn_array_get_last_block(arr);
37
 
        block->used = block->used | DYN_BLOCK_FULL_FLAG;
38
 
 
39
 
        heap = arr->heap;
40
 
 
41
 
        block = mem_heap_alloc(heap, sizeof(dyn_block_t));
42
 
 
43
 
        block->used = 0;
44
 
 
45
 
        UT_LIST_ADD_LAST(list, arr->base, block);
46
 
 
47
 
        return(block);
48
 
}