summaryrefslogtreecommitdiff
path: root/storage/xtradb/dyn
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-06-09 13:16:11 +0200
committerunknown <knielsen@knielsen-hq.org>2009-06-09 13:16:11 +0200
commita6b7f71329ceb7d0188572f494b5d1a1f0461fc5 (patch)
treed7e62c1af5118cd3ec9346de436569e907fcc51d /storage/xtradb/dyn
parentb125770aaadd09e839ad9211047e88095984308b (diff)
parent107072563d771422c9bbb9aeeedce8ae19c5b838 (diff)
downloadmariadb-git-a6b7f71329ceb7d0188572f494b5d1a1f0461fc5.tar.gz
Import Percona XtraDB into the MariaDB source tree.
Diffstat (limited to 'storage/xtradb/dyn')
-rw-r--r--storage/xtradb/dyn/dyn0dyn.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/storage/xtradb/dyn/dyn0dyn.c b/storage/xtradb/dyn/dyn0dyn.c
new file mode 100644
index 00000000000..16e82eaed66
--- /dev/null
+++ b/storage/xtradb/dyn/dyn0dyn.c
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+
+*****************************************************************************/
+
+/******************************************************
+The dynamically allocated array
+
+Created 2/5/1996 Heikki Tuuri
+*******************************************************/
+
+#include "dyn0dyn.h"
+#ifdef UNIV_NONINL
+#include "dyn0dyn.ic"
+#endif
+
+/****************************************************************
+Adds a new block to a dyn array. */
+UNIV_INTERN
+dyn_block_t*
+dyn_array_add_block(
+/*================*/
+ /* out: created block */
+ dyn_array_t* arr) /* in: dyn array */
+{
+ mem_heap_t* heap;
+ dyn_block_t* block;
+
+ ut_ad(arr);
+ ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
+
+ if (arr->heap == NULL) {
+ UT_LIST_INIT(arr->base);
+ UT_LIST_ADD_FIRST(list, arr->base, arr);
+
+ arr->heap = mem_heap_create(sizeof(dyn_block_t));
+ }
+
+ block = dyn_array_get_last_block(arr);
+ block->used = block->used | DYN_BLOCK_FULL_FLAG;
+
+ heap = arr->heap;
+
+ block = mem_heap_alloc(heap, sizeof(dyn_block_t));
+
+ block->used = 0;
+
+ UT_LIST_ADD_LAST(list, arr->base, block);
+
+ return(block);
+}