summaryrefslogtreecommitdiffstats
path: root/src/H5Oattribute.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-14 16:04:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-14 16:04:42 (GMT)
commit665366d499eb7831d90655c704507c4920313361 (patch)
treebb324f8f1f7bb10b01da9d8007a59d006349a47e /src/H5Oattribute.c
parent7de10b48334d0113b1733f145c7d2bb4e9d4f9f1 (diff)
downloadhdf5-665366d499eb7831d90655c704507c4920313361.zip
hdf5-665366d499eb7831d90655c704507c4920313361.tar.gz
hdf5-665366d499eb7831d90655c704507c4920313361.tar.bz2
[svn-r14085] Description:
Refactor H5HF_size() size statistics code for fractal heap to conform to how the rest of the fractal heap routines work. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src/H5Oattribute.c')
-rw-r--r--src/H5Oattribute.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index aacf3a0..5050e5c 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1711,7 +1711,8 @@ done:
herr_t
H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HF_t *fheap = NULL; /* Fractal heap handle */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_attr_bh_info, FAIL)
@@ -1739,13 +1740,28 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
/* Get storage size of fractal heap, if it's used */
- if(H5F_addr_defined(ainfo.fheap_addr))
- if(H5HF_size(f, dxpl_id, ainfo.fheap_addr, &(bh_info->heap_size)) < 0)
+ if(H5F_addr_defined(ainfo.fheap_addr)) {
+ /* Open the fractal heap for attributes */
+ if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
+
+ /* Get heap storage size */
+ if(H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
+
+ /* Release the fractal heap */
+ if(H5HF_close(fheap, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+ fheap = NULL;
+ } /* end if */
} /* end else */
} /* end if */
done:
+ /* Release resources */
+ if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close fractal heap")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_attr_bh_info() */