1
/*****************************************************************************
3
Copyright (C) 2006, 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
/*******************************************************************//**
20
@file include/ut0vec.ic
21
A vector of pointers to data items
23
Created 4/6/2006 Osku Salerma
24
************************************************************************/
26
/****************************************************************//**
27
Get number of elements in vector.
28
@return number of elements in vector */
33
const ib_vector_t* vec) /*!< in: vector */
38
/****************************************************************//**
40
@return n'th element */
45
ib_vector_t* vec, /*!< in: vector */
46
ulint n) /*!< in: element index to get */
53
/****************************************************************//**
54
Remove the last element from the vector.
55
@return last vector element */
60
ib_vector_t* vec) /*!< in/out: vector */
66
elem = vec->data[vec->used];
68
ut_d(vec->data[vec->used] = NULL);
69
UNIV_MEM_INVALID(&vec->data[vec->used], sizeof(*vec->data));
74
/****************************************************************//**
75
Free the underlying heap of the vector. Note that vec is invalid
81
ib_vector_t* vec) /*!< in, own: vector */
83
mem_heap_free(vec->heap);
86
/****************************************************************//**
87
Test whether a vector is empty or not.
88
@return TRUE if empty */
93
const ib_vector_t* vec) /*!< in: vector */
95
return(ib_vector_size(vec) == 0);