~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/ut/ut0vec.c

  • Committer: Monty Taylor
  • Date: 2009-03-06 03:33:24 UTC
  • mfrom: (916.1.2 merge)
  • Revision ID: mordred@inaugust.com-20090306033324-dcedf80g9qzywbvu
Merged Brian's merge... re-rotate the tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
4
 
 
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.
8
 
 
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.
12
 
 
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
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/*******************************************************************//**
20
 
@file ut/ut0vec.c
21
 
A vector of pointers to data items
22
 
 
23
 
Created 4/6/2006 Osku Salerma
24
 
************************************************************************/
25
 
 
26
1
#include "ut0vec.h"
27
2
#ifdef UNIV_NONINL
28
3
#include "ut0vec.ic"
29
4
#endif
30
5
#include <string.h>
31
6
 
32
 
/****************************************************************//**
33
 
Create a new vector with the given initial size.
34
 
@return vector */
 
7
/********************************************************************
 
8
Create a new vector with the given initial size. */
35
9
UNIV_INTERN
36
10
ib_vector_t*
37
11
ib_vector_create(
38
12
/*=============*/
39
 
        mem_heap_t*     heap,   /*!< in: heap */
40
 
        ulint           size)   /*!< in: initial size */
 
13
                                /* out: vector */
 
14
        mem_heap_t*     heap,   /* in: heap */
 
15
        ulint           size)   /* in: initial size */
41
16
{
42
17
        ib_vector_t*    vec;
43
18
 
53
28
        return(vec);
54
29
}
55
30
 
56
 
/****************************************************************//**
 
31
/********************************************************************
57
32
Push a new element to the vector, increasing its size if necessary. */
58
33
UNIV_INTERN
59
34
void
60
35
ib_vector_push(
61
36
/*===========*/
62
 
        ib_vector_t*    vec,    /*!< in: vector */
63
 
        void*           elem)   /*!< in: data element */
 
37
        ib_vector_t*    vec,    /* in: vector */
 
38
        void*           elem)   /* in: data element */
64
39
{
65
40
        if (vec->used >= vec->total) {
66
41
                void**  new_data;