summaryrefslogtreecommitdiffstats
path: root/src/H5B2cache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-10-27 19:18:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-10-27 19:18:45 (GMT)
commitab3f3e0219d80b5407fe5da785a7faae443c7ffc (patch)
treec51c1dc909d9b5e82f077620ca4fc423a5d1edd4 /src/H5B2cache.c
parent4af649f03d3eb2826616c6f730bc4281c027a536 (diff)
downloadhdf5-ab3f3e0219d80b5407fe5da785a7faae443c7ffc.zip
hdf5-ab3f3e0219d80b5407fe5da785a7faae443c7ffc.tar.gz
hdf5-ab3f3e0219d80b5407fe5da785a7faae443c7ffc.tar.bz2
[svn-r17749] Description:
Refactor v2 B-tree code to bring it further in line with how the fractal heap code works, to make forthcoming modificaions easier. Also minor tweaks to the fractal heap code to clean it up a bit more also. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5B2cache.c')
-rw-r--r--src/H5B2cache.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index ffb2995..859554e 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -170,9 +170,8 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, voi
HDassert(cls);
/* Allocate new B-tree header and reset cache info */
- if(NULL == (hdr = H5FL_MALLOC(H5B2_hdr_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&hdr->cache_info, 0, sizeof(H5AC_info_t));
+ if(NULL == (hdr = H5B2_hdr_alloc()))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header")
/* Wrap the local buffer for serialized header info */
if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf))))
@@ -252,7 +251,8 @@ done:
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
if(!ret_value && hdr)
- (void)H5B2_cache_hdr_dest(f, hdr);
+ if(H5B2_hdr_free(hdr) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -407,9 +407,6 @@ H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr)
if(H5B2_hdr_free(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header info")
- /* Free B-tree header info */
- (void)H5FL_FREE(H5B2_hdr_t, hdr);
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_cache_hdr_dest() */
@@ -763,7 +760,7 @@ H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *internal)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Free B-tree internal node info */
- H5FL_FREE(H5B2_internal_t, internal);
+ internal = H5FL_FREE(H5B2_internal_t, internal);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1081,7 +1078,7 @@ H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *leaf)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header")
/* Free B-tree leaf node info */
- H5FL_FREE(H5B2_leaf_t, leaf);
+ leaf = H5FL_FREE(H5B2_leaf_t, leaf);
done:
FUNC_LEAVE_NOAPI(ret_value)