summaryrefslogtreecommitdiffstats
path: root/src/H5SL.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-04-08 03:46:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-04-08 03:46:48 (GMT)
commit13ca97618db62034fa78b8d87f7160cb2a1f4bfc (patch)
tree08409d4a9670de57059d50e7dc4790d7d88ded43 /src/H5SL.c
parentd4ab501d637389fc8f6dbae8ab12c6e032b19dfd (diff)
downloadhdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.zip
hdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.tar.gz
hdf5-13ca97618db62034fa78b8d87f7160cb2a1f4bfc.tar.bz2
[svn-r10580] Purpose:
Code optimization Description: Add "base" size to array free list code, to accomodate skip list nodes. Platforms tested: FreeBSD 4.11 (sleipnir) Solaris 2.9 (shanti)
Diffstat (limited to 'src/H5SL.c')
-rw-r--r--src/H5SL.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/H5SL.c b/src/H5SL.c
index 85d7080..3748644 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -52,7 +52,6 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5MMprivate.h" /* Memory management */
#include "H5SLprivate.h" /* Skip list routines */
/* Local Macros */
@@ -75,7 +74,7 @@
else \
X->forward[0]->backward=X->backward; \
tmp=X->item; \
- H5MM_xfree(X); \
+ H5FL_ARR_FREE(H5SL_node_ptr_t,X); \
while(SLIST->curr_level>0 && SLIST->header->forward[SLIST->curr_level]==NULL) \
SLIST->curr_level--; \
SLIST->nobjs--; \
@@ -182,6 +181,10 @@ static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data
/* Declare a free list to manage the H5SL_t struct */
H5FL_DEFINE_STATIC(H5SL_t);
+/* Declare a "base + array" list to manage the H5SL_node_t struct */
+typedef H5SL_node_t *H5SL_node_ptr_t;
+H5FL_BARR_DEFINE_STATIC(H5SL_node_t,H5SL_node_ptr_t,H5SL_LEVEL_MAX);
+
/*--------------------------------------------------------------------------
NAME
@@ -289,7 +292,7 @@ H5SL_new_node(size_t lvl, void *item, const void *key)
FUNC_ENTER_NOAPI_NOINIT(H5SL_new_node);
/* Allocate the node */
- if((ret_value=H5MM_malloc(sizeof(H5SL_node_t)+(sizeof(H5SL_node_t *)*(lvl+1))))==NULL)
+ if((ret_value=H5FL_ARR_MALLOC(H5SL_node_ptr_t,(lvl+1)))==NULL)
HGOTO_ERROR(H5E_SLIST,H5E_NOSPACE,NULL,"memory allocation failed");
/* Initialize node */
@@ -465,7 +468,7 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
if(op!=NULL)
(void)(op)(node->item,(void *)node->key,op_data);
- H5MM_xfree(node);
+ H5FL_ARR_FREE(H5SL_node_ptr_t,node);
node=next_node;
} /* end while */
@@ -522,7 +525,7 @@ H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
(void)H5SL_release_common(slist,op,op_data); /* always succeeds */
/* Release header node */
- H5MM_xfree(slist->header);
+ H5FL_ARR_FREE(H5SL_node_ptr_t,slist->header);
/* Free skip list object */
H5FL_FREE(H5SL_t,slist);