summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:13:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:13:05 (GMT)
commitfc152eff1c4a7118f43bddb6ac3c9b3c4d69bfac (patch)
tree32b827b1ee2be3a49f159225c2597de10a4cd248 /src/H5B.c
parent3a0524dfa9d0067392c9a8bbb9a31934aa8e90ba (diff)
downloadhdf5-fc152eff1c4a7118f43bddb6ac3c9b3c4d69bfac.zip
hdf5-fc152eff1c4a7118f43bddb6ac3c9b3c4d69bfac.tar.gz
hdf5-fc152eff1c4a7118f43bddb6ac3c9b3c4d69bfac.tar.bz2
[svn-r8302] Purpose:
Code optimization Description: Move handling for free list arrays that have no maximum size to separate set of routines and optimize computations for free list arrays with maximum size to avoid re-computing sizes all the time. Platforms tested: h5committest Solaris 2.7 (arabica)
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 8e8cade..c2437c1 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -178,10 +178,10 @@ H5FL_BLK_DEFINE_STATIC(page);
H5FL_BLK_DEFINE_STATIC(native_block);
/* Declare a free list to manage the H5B_key_t array information */
-H5FL_ARR_DEFINE_STATIC(H5B_key_t,-1);
+H5FL_SEQ_DEFINE_STATIC(H5B_key_t);
/* Declare a free list to manage the haddr_t array information */
-H5FL_ARR_DEFINE_STATIC(haddr_t,-1);
+H5FL_SEQ_DEFINE_STATIC(haddr_t);
/* Declare a free list to manage the H5B_t struct */
H5FL_DEFINE_STATIC(H5B_t);
@@ -251,8 +251,8 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
bt->nchildren = 0;
if (NULL==(bt->page=H5FL_BLK_CALLOC(page,size)) ||
NULL==(bt->native=H5FL_BLK_MALLOC(native_block,total_native_keysize)) ||
- NULL==(bt->child=H5FL_ARR_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))) ||
- NULL==(bt->key=H5FL_ARR_MALLOC(H5B_key_t,(size_t)(2*H5F_KVALUE(f,type)+1))))
+ NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))) ||
+ NULL==(bt->key=H5FL_SEQ_MALLOC(H5B_key_t,(size_t)(2*H5F_KVALUE(f,type)+1))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node");
/*
@@ -348,8 +348,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
bt->ndirty = 0;
if (NULL==(bt->page=H5FL_BLK_MALLOC(page,size)) ||
NULL==(bt->native=H5FL_BLK_MALLOC(native_block,total_nkey_size)) ||
- NULL==(bt->key=H5FL_ARR_MALLOC(H5B_key_t,(size_t)(2*H5F_KVALUE(f,type)+1))) ||
- NULL==(bt->child=H5FL_ARR_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))))
+ NULL==(bt->key=H5FL_SEQ_MALLOC(H5B_key_t,(size_t)(2*H5F_KVALUE(f,type)+1))) ||
+ NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, bt->page)<0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node");
@@ -534,8 +534,8 @@ H5B_dest(H5F_t UNUSED *f, H5B_t *bt)
/* Verify that node is clean */
assert(bt->cache_info.dirty==0);
- H5FL_ARR_FREE(haddr_t,bt->child);
- H5FL_ARR_FREE(H5B_key_t,bt->key);
+ H5FL_SEQ_FREE(haddr_t,bt->child);
+ H5FL_SEQ_FREE(H5B_key_t,bt->key);
H5FL_BLK_FREE(page,bt->page);
H5FL_BLK_FREE(native_block,bt->native);
H5FL_FREE(H5B_t,bt);
@@ -1541,7 +1541,7 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
* We've reached the left-most leaf. Now follow the right-sibling
* pointer from leaf to leaf until we've processed all leaves.
*/
- if (NULL==(child=H5FL_ARR_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))) ||
+ if (NULL==(child=H5FL_SEQ_MALLOC(haddr_t,(size_t)(2*H5F_KVALUE(f,type)))) ||
NULL==(key=H5MM_malloc((2*H5F_KVALUE(f, type)+1)*type->sizeof_nkey)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
for (cur_addr=addr, ret_value=0; H5F_addr_defined(cur_addr) && !ret_value; cur_addr=next_addr) {
@@ -1580,7 +1580,7 @@ H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t op
done:
if(child!=NULL)
- H5FL_ARR_FREE(haddr_t,child);
+ H5FL_SEQ_FREE(haddr_t,child);
if(key!=NULL)
H5MM_xfree(key);
FUNC_LEAVE_NOAPI(ret_value);
@@ -2150,8 +2150,8 @@ H5B_copy(H5F_t *f, const H5B_t *old_bt)
if (NULL==(new_node->page=H5FL_BLK_MALLOC(page,size)) ||
NULL==(new_node->native=H5FL_BLK_MALLOC(native_block,total_native_keysize)) ||
- NULL==(new_node->child=H5FL_ARR_MALLOC(haddr_t,nkeys)) ||
- NULL==(new_node->key=H5FL_ARR_MALLOC(H5B_key_t,(nkeys+1))))
+ NULL==(new_node->child=H5FL_SEQ_MALLOC(haddr_t,nkeys)) ||
+ NULL==(new_node->key=H5FL_SEQ_MALLOC(H5B_key_t,(nkeys+1))))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node");
/* Copy the other structures */
@@ -2175,8 +2175,8 @@ done:
if(new_node) {
H5FL_BLK_FREE (page,new_node->page);
H5FL_BLK_FREE (native_block,new_node->native);
- H5FL_ARR_FREE (haddr_t,new_node->child);
- H5FL_ARR_FREE (H5B_key_t,new_node->key);
+ H5FL_SEQ_FREE (haddr_t,new_node->child);
+ H5FL_SEQ_FREE (H5B_key_t,new_node->key);
H5FL_FREE (H5B_t,new_node);
} /* end if */
} /* end if */