summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-08-12 18:26:15 (GMT)
committerGitHub <noreply@github.com>2021-08-12 18:26:15 (GMT)
commite2c47ffb01b42a3da930e2b175b40810d4bcfbca (patch)
tree7b6f0410430d29d09342106afae0f886a9b45963 /src/H5HL.c
parentc2e61724aa19f84bda9fd730236d80f4af1e4e74 (diff)
downloadhdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.zip
hdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.tar.gz
hdf5-e2c47ffb01b42a3da930e2b175b40810d4bcfbca.tar.bz2
Merge1 issue 839 PRs to hdf5 1 12 (#904)
* Fixes for a couple of trivial warnings (#676) * Committing clang-format changes * Trivial warning fixes: * Removes an unused done target in H5Tbit.c * Add (void) to quiet "ignored return value" warnings in the generators (which generally ignore errors) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes alternative function enter/leave macro scheme (#678) * Committing clang-format changes * Converted BEGIN_FUNC, etc. macros to FUNC_ENTER * Rips out the BEGIN_FUNC, etc. macros * Removes 'end if', etc. comments from H5HL package * Committing clang-format changes * Fixes an H5EA iterate issue * Fixes an issue in the H5FA iterator code * Further cleanup in bin/trace after macro removal * Iterator changes in H5EA and H5FA Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Various CMake changes (#679) * Committing clang-format changes * Several CMake updates: * Removes unused HDF5_ENABLE_HSIZET * Switches TEST_SHELL_SCRIPTS to ON * Sets SH_PROGRAM to bash instead of sh * Set default build type back to RelWithDebInfo Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * err_compat test cleanup (#681) * Committing clang-format changes * Cleans up err_compat test and output * Formatted source Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * CMake fix for sporadic flush2 failures (#692) * Committing clang-format changes * Runs the flush1/flush2 tests in their own directory Avoids file deletions by other tests. * Revert "Runs the flush1/flush2 tests in their own directory" This reverts commit 746c04882434cb502e4231de8f7dd5acb4949f54. Also pulls the flush files from the clean list, which is a simpler fix. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Ubsan fixes (#498) * Fixed use of null pointer identified by UBSan UBSan warned: runtime error: member access within null pointer of type 'named_dt_t' (aka 'struct named_dt_t') with these two tests: H5REPACK-committed_dt_DFF H5REPACK-committed_dt Reformulated per @gnuoyd suggestion. * Fixed undefined float -> unsigned char conversion in HL_test_image * Removed dead skip_overflow_tests_g global The global `skip_overflow_tests_g` was being set but never read. * Don't treat 2d array as 1d array, fixing UBSan complaint in `CPP_testhdf5` * Committing clang-format changes * Remove extra ']' in line 730. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * BUG: DataSet assignment operator is missing (#503) * BUG: DataSet assignment operator is missing * Some compilers complain if the copy constructor is given explicitly but the assignment operator is implicitly set to default. * Explicitly defining the assignment operator allows us to properly handle reference counters for shared resources. * BUG: DataSet assignment operator is missing. * Mimicking code of H5DataType::operator() as suggested by @bmribler. * Added test Description: Added test for DataSet::operator= that Leengit added Platform tested: Linux/64 (jelly) * Removed Author field. * Commit clang format changes. * Entry for Leengit's github PR #503 * Removed lines left by mistake Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org> Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Hdf5 merge pr7 (#516) * Modify temporary rpath for testing in java example scripts. * Update URL in source file Copyright headers for web copy of COPYING (license) file. * Add release_docs/code-conventions.md file. * Add script to test h5py. * Fix script error. * Add file h5pytest.yml. * Test declaration of counter variables in for loops. * Committing clang-format changes * Committing clang-format changes * Added [] to line 126 of H5LTanalyze.l. Ran bin/genparser with flex v2.6.4 and Bison v3.0.4 on jelly. * Revert "Added [] to line 126 of H5LTanalyze.l." This reverts commit e4a9cee441efa75b16a8ee030c86189e186dd266. * Revert extra commits to match canonical develop. * Add cmake variable HDF5_LIB_INFIX (#7) * Add cmake variable HDF5_LIB_INFIX This infix is added to all library names after 'hdf5'. e.g. the infix '_openmpi' results in the library name 'libhdf5_openmpi.so' This name is used in packages on debian based systems. (see https://packages.debian.org/jessie/amd64/libhdf5-openmpi-8/filelist) This option is useful when testing projects on debian based systems with custom builds of hdf5 while trying to minimize differences between the custom setup and the environment created by installing system packages. * Added RELEASE.txt entry for HDF5_LIB_INFIX. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raphael Grimm <barcode@users.noreply.github.com> * Fixes a segfault when H5Pset_mdc_log_options is called multiple times on a fapl (#601) * Committing clang-format changes * Fixes a segfault when H5Pset_mdc_log_options() is called multiple times An internal string is incorrectly freed when the API call is invoked multiple times on a property list, which will usually cause a segfault to occur. On the first call the log location is NULL so the problem doesn't occur. Fixes HDFFV-11239 * Fixes typos Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix for a segfault when H5Pset_fapl_log is passed an invalid fapl ID (#607) * Committing clang-format changes * Fixes an issue where H5Pset_fapl_log sefaults when passed an invalid fapl ID This was due to a pointer-containing struct being memset after the first internal API call. If the first call failed, the error condition would check if the pointer was not NULL and then attempt to free it if not. This would lead to the freeing of a wild pointer if an invalid fapl ID were passed in. This was fixed by reordering the memset and adding a test to ensure the problem stays fixed. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fixes crashes when size_hint > UINT32_MAX is passed to H5Gcreate1 (#611) * Committing clang-format changes * Fixes incorrect size_hint handling in H5Gcreate1 * Updates the size hint type for group creation * Updates the RELEASE.txt note * Revert "Updates the RELEASE.txt note" This reverts commit 3df386acca806d652bbe2209f7c4503b30f068ff. * Reverts previous behavior to use a uint32_t struct field * Updates RELEASE.txt Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sean McBride <sean@rogue-research.com> Co-authored-by: Lee Newberg <35611400+Leengit@users.noreply.github.com> Co-authored-by: Binh-Minh Ribler <bmribler@hdfgroup.org> Co-authored-by: Raphael Grimm <barcode@users.noreply.github.com>
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c392
1 files changed, 217 insertions, 175 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index ca83445..1f2369a 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -98,11 +98,15 @@ H5FL_BLK_DEFINE(lheap_chunk);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/))
-
+herr_t
+H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/)
+{
H5HL_t * heap = NULL; /* Heap created */
H5HL_prfx_t *prfx = NULL; /* Heap prefix */
hsize_t total_size = 0; /* Total heap size on disk */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
/* check arguments */
HDassert(f);
@@ -115,12 +119,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h
/* Allocate new heap structure */
if (NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f))))
- H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate new heap struct");
/* Allocate file space */
total_size = heap->prfx_size + size_hint;
if (HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, total_size)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory");
/* Initialize info */
heap->single_cache_obj = TRUE;
@@ -128,52 +132,52 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, size_t size_h
heap->dblk_size = size_hint;
if (size_hint)
if (NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* free list */
if (size_hint) {
if (NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
heap->freelist->offset = 0;
heap->freelist->size = size_hint;
heap->freelist->prev = heap->freelist->next = NULL;
heap->free_block = 0;
- } /* end if */
+ }
else {
heap->freelist = NULL;
heap->free_block = H5HL_FREE_NULL;
- } /* end else */
+ }
/* Allocate the heap prefix */
if (NULL == (prfx = H5HL__prfx_new(heap)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Add to cache */
if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix");
/* Set address to return */
*addr_p = heap->prfx_addr;
- CATCH
+done:
if (ret_value < 0) {
*addr_p = HADDR_UNDEF;
if (prfx) {
if (FAIL == H5HL__prfx_dest(prfx))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix");
- } /* end if */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix");
+ }
else {
if (heap) {
if (H5F_addr_defined(heap->prfx_addr))
if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size))
- H5E_THROW(H5E_CANTFREE, "can't release heap data?");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?");
if (FAIL == H5HL__dest(heap))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap");
- } /* end if */
- } /* end else */
- } /* end if */
-
-END_FUNC(PRIV) /* end H5HL_create() */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap");
+ }
+ }
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_create() */
/*-------------------------------------------------------------------------
* Function: H5HL__minimize_heap_space
@@ -188,16 +192,19 @@ END_FUNC(PRIV) /* end H5HL_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap))
-
+static herr_t
+H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap)
+{
size_t new_heap_size = heap->dblk_size; /* New size of heap */
+ herr_t ret_value = SUCCEED;
- /* check args */
+ FUNC_ENTER_STATIC
+
+ /* Check args */
HDassert(f);
HDassert(heap);
- /*
- * Check to see if we can reduce the size of the heap in memory by
+ /* Check to see if we can reduce the size of the heap in memory by
* eliminating free blocks at the tail of the buffer before flushing the
* buffer out.
*/
@@ -211,29 +218,25 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
if (tmp_fl->offset + tmp_fl->size == heap->dblk_size) {
last_fl = tmp_fl;
break;
- } /* end if */
+ }
- /*
- * Found free block at the end of the buffer, decide what to do
+ /* Found free block at the end of the buffer, decide what to do
* about it
*/
if (last_fl) {
- /*
- * If the last free block's size is more than half the memory
+ /* If the last free block's size is more than half the memory
* buffer size (and the memory buffer is larger than the
* minimum size), reduce or eliminate it.
*/
if (last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) {
- /*
- * Reduce size of buffer until it's too small or would
+ /* Reduce size of buffer until it's too small or would
* eliminate the free block
*/
while (new_heap_size > H5HL_MIN_HEAP &&
new_heap_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f)))
new_heap_size /= 2;
- /*
- * Check if reducing the memory buffer size would
+ /* Check if reducing the memory buffer size would
* eliminate the free block
*/
if (new_heap_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) {
@@ -246,31 +249,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
- } /* end if */
+ }
else {
- /*
- * Set the size of the memory buffer to the start
+ /* Set the size of the memory buffer to the start
* of the free list
*/
new_heap_size = last_fl->offset;
/* Eliminate the free block from the list */
last_fl = H5HL__remove_free(heap, last_fl);
- } /* end else */
- } /* end if */
+ }
+ }
else {
/* Truncate the free block */
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
HDassert(last_fl->size == H5HL_ALIGN(last_fl->size));
- } /* end else */
- } /* end if */
- } /* end if */
- } /* end if */
+ }
+ }
+ }
+ }
- /*
- * If the heap grew smaller than disk storage then move the
+ /* If the heap grew smaller than disk storage then move the
* data segment of the heap to another contiguous block of disk
* storage.
*/
@@ -279,17 +280,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *
/* Resize the memory buffer */
if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Reallocate data block in file */
if (FAIL == H5HL__dblk_realloc(f, heap, new_heap_size))
- H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed");
- } /* end if */
-
- CATCH
- /* No special processing on errors */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed");
+ }
-END_FUNC(STATIC) /* H5HL__minimize_heap_space() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5HL__minimize_heap_space() */
/*-------------------------------------------------------------------------
* Function: H5HL_protect
@@ -304,20 +304,24 @@ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags))
-
+H5HL_t *
+H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags)
+{
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_dblk_t * dblk = NULL; /* Local heap data block */
H5HL_t * heap = NULL; /* Heap data structure */
unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */
unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */
+ H5HL_t * ret_value = NULL;
- /* check arguments */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- /* only the H5AC__READ_ONLY_FLAG may appear in flags */
+ /* Only the H5AC__READ_ONLY_FLAG may appear in flags */
HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0);
/* Construct the user data for protect callback */
@@ -328,7 +332,7 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Protect the local heap prefix */
if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -344,12 +348,12 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Protect the local heap data block */
if (NULL ==
(dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block");
/* Set the flag for pinning the data block when unprotecting it */
dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG;
- } /* end if */
- } /* end if */
+ }
+ }
/* Increment # of times heap is protected */
heap->prots++;
@@ -357,16 +361,17 @@ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, haddr_t addr,
/* Set return value */
ret_value = heap;
- CATCH
+done:
/* Release the prefix from the cache, now pinned */
if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix");
/* Release the data block from the cache, now pinned */
if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block");
-END_FUNC(PRIV) /* end H5HL_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_protect() */
/*-------------------------------------------------------------------------
* Function: H5HL_offset_into
@@ -374,26 +379,31 @@ END_FUNC(PRIV) /* end H5HL_protect() */
* Purpose: Called directly after the call to H5HL_protect so that
* a pointer to the object in the heap can be obtained.
*
- * Return: Success: Valid pointer.
- * Failure: Can't fail
+ * Return: Success: Valid pointer
+ * Failure: NULL
*
* Programmer: Bill Wendling
* Sept. 17, 2003
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, void *, NULL, NULL, H5HL_offset_into(const H5HL_t *heap, size_t offset))
+void *
+H5HL_offset_into(const H5HL_t *heap, size_t offset)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
/* Sanity check */
HDassert(heap);
if (offset >= heap->dblk_size)
- H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to offset into local heap data block");
ret_value = heap->dblk_image + offset;
- CATCH
-/* No special processing on errors */
-END_FUNC(PRIV) /* end H5HL_offset_into() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_offset_into() */
/*-------------------------------------------------------------------------
* Function: H5HL_unprotect
@@ -407,9 +417,14 @@ END_FUNC(PRIV) /* end H5HL_offset_into() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
+herr_t
+H5HL_unprotect(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(heap);
/* Decrement # of times heap is protected */
@@ -421,8 +436,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
if (heap->single_cache_obj) {
/* Mark local heap prefix as evictable again */
if (FAIL == H5AC_unpin_entry(heap->prfx))
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block");
+ }
else {
/* Sanity check */
HDassert(heap->dblk);
@@ -430,14 +445,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap))
/* Mark local heap data block as evictable again */
/* (data block still pins prefix) */
if (FAIL == H5AC_unpin_entry(heap->dblk))
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block");
- } /* end else */
- } /* end if */
-
- CATCH
- /* No special processing on errors */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block");
+ }
+ }
-END_FUNC(PRIV) /* end H5HL_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5HL__remove_free
@@ -452,7 +466,12 @@ END_FUNC(PRIV) /* end H5HL_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl))
+static H5HL_free_t *
+H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl)
+{
+ H5HL_free_t *ret_value = NULL;
+
+ FUNC_ENTER_STATIC_NOERR
if (fl->prev)
fl->prev->next = fl->next;
@@ -465,7 +484,8 @@ BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap
/* H5FL_FREE always returns NULL so we can't check for errors */
ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl);
-END_FUNC(STATIC) /* end H5HL__remove_free() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__remove_free() */
/*-------------------------------------------------------------------------
* Function: H5HL__dirty
@@ -479,9 +499,14 @@ END_FUNC(STATIC) /* end H5HL__remove_free() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap))
+static herr_t
+H5HL__dirty(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
HDassert(heap);
HDassert(heap->prfx);
@@ -491,17 +516,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap))
HDassert(heap->dblk);
if (FAIL == H5AC_mark_entry_dirty(heap->dblk))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty");
+ }
/* Mark heap prefix as dirty */
if (FAIL == H5AC_mark_entry_dirty(heap->prfx))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty");
-
- CATCH
- /* No special processing on errors */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty");
-END_FUNC(STATIC) /* end H5HL__dirty() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dirty() */
/*-------------------------------------------------------------------------
* Function: H5HL_insert
@@ -519,13 +543,16 @@ END_FUNC(STATIC) /* end H5HL__dirty() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
- H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out))
-
+herr_t
+H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out)
+{
H5HL_free_t *fl = NULL, *last_fl = NULL;
size_t need_size;
size_t offset = 0;
hbool_t found;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
/* Check arguments */
HDassert(f);
@@ -541,7 +568,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
* if an error occurs -QAK)
*/
if (FAIL == H5HL__dirty(heap))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty");
/* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
@@ -574,7 +601,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
/* Track free space that's closest to end of heap */
last_fl = fl;
}
- } /* end for */
+ }
/* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
@@ -612,7 +639,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
was_extended = H5MF_try_extend(f, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size),
(hsize_t)need_more);
if (FAIL == was_extended)
- H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap");
/* Check if we extended the heap data block in file */
if (was_extended == TRUE) {
@@ -620,22 +647,22 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
if (heap->single_cache_obj) {
/* Resize prefix+data block */
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache");
+ }
else {
/* Resize 'standalone' data block */
if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache");
- } /* end else */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache");
+ }
/* Note new size */
heap->dblk_size = new_dblk_size;
- } /* end if */
+ }
else { /* ...if we can't, allocate a new chunk & release the old */
/* Reallocate data block in file */
if (FAIL == H5HL__dblk_realloc(f, heap, new_dblk_size))
- H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed");
+ }
/* If the last free list in the heap is at the end of the heap, extend it */
if (last_fl && last_fl->offset + last_fl->size == old_dblk_size) {
@@ -657,7 +684,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
#endif
last_fl = H5HL__remove_free(heap, last_fl);
}
- } /* end if */
+ }
else {
/* Create a new free list element large enough that we can
* take some space out of it right away.
@@ -665,7 +692,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
offset = old_dblk_size;
if (need_more - need_size >= H5HL_SIZEOF_FREE(f)) {
if (NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
fl->offset = old_dblk_size + need_size;
fl->size = need_more - need_size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
@@ -682,7 +709,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
(unsigned long)(need_more - need_size), __LINE__);
#endif
}
- } /* end else */
+ }
#ifdef H5HL_DEBUG
if (H5DEBUG(HL)) {
@@ -691,22 +718,21 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
}
#endif
if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
/* Clear new section so junk doesn't appear in the file */
/* (Avoid clearing section which will be overwritten with newly inserted data) */
HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size)));
- } /* end if */
+ }
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
*offset_out = offset;
- CATCH
- /* No special processing on exit */
-
-END_FUNC(PRIV) /* H5HL_insert() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5HL_insert() */
/*-------------------------------------------------------------------------
* Function: H5HL_remove
@@ -731,11 +757,15 @@ END_FUNC(PRIV) /* H5HL_insert() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size))
+herr_t
+H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size)
+{
+ H5HL_free_t *fl = NULL;
+ herr_t ret_value = SUCCEED;
- H5HL_free_t *fl = NULL;
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(size > 0);
@@ -746,17 +776,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
HDassert(offset < heap->dblk_size);
HDassert(offset + size <= heap->dblk_size);
- /* Mark heap as dirty in cache */
- /* (A bit early in the process, but it's difficult to determine in the
+ /* Mark heap as dirty in cache
+ *
+ * (A bit early in the process, but it's difficult to determine in the
* code below where to mark the heap as dirty, especially in error cases,
* so we just accept that an extra flush of the heap info could occur
* if an error occurs -QAK)
*/
if (FAIL == H5HL__dirty(heap))
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty");
- /*
- * Check if this chunk can be prepended or appended to an already
+ /* Check if this chunk can be prepended or appended to an already
* free chunk. It might also fall between two chunks in such a way
* that all three chunks can be combined into one.
*/
@@ -779,17 +809,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
fl2 = H5HL__remove_free(heap, fl2);
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
}
- H5_LEAVE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
fl2 = fl2->next;
}
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
}
- H5_LEAVE(SUCCEED);
+ HGOTO_DONE(SUCCEED)
}
else if (fl->offset + fl->size == offset) {
fl->size += size;
@@ -802,20 +832,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
fl2 = H5HL__remove_free(heap, fl2);
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
- } /* end if */
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
+ }
+ HGOTO_DONE(SUCCEED)
+ }
fl2 = fl2->next;
- } /* end while */
+ }
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) {
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
- } /* end if */
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
+ }
+ HGOTO_DONE(SUCCEED)
+ }
fl = fl->next;
- } /* end while */
+ }
/*
* The amount which is being removed must be large enough to
@@ -828,14 +858,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size);
}
#endif
- H5_LEAVE(SUCCEED);
- } /* end if */
+ HGOTO_DONE(SUCCEED)
+ }
- /*
- * Add an entry to the free list.
- */
+ /* Add an entry to the free list */
if (NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");
fl->offset = offset;
fl->size = size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
@@ -848,12 +876,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap,
if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size))
if (FAIL == H5HL__minimize_heap_space(f, heap))
- H5E_THROW(H5E_CANTFREE, "heap size minimization failed");
-
- CATCH
- /* No special processing on exit */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed");
-END_FUNC(PRIV) /* end H5HL_remove() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_remove() */
/*-------------------------------------------------------------------------
* Function: H5HL_delete
@@ -867,15 +894,19 @@ END_FUNC(PRIV) /* end H5HL_remove() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr))
-
+herr_t
+H5HL_delete(H5F_t *f, haddr_t addr)
+{
H5HL_t * heap = NULL; /* Local heap to delete */
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
H5HL_dblk_t * dblk = NULL; /* Local heap data block */
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
@@ -888,7 +919,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -898,21 +929,22 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)
/* Protect the local heap data block */
if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap,
H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block");
/* Set the flags for releasing the prefix and data block */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
+done:
/* Release the data block from the cache, now deleted */
if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block");
/* Release the prefix from the cache, now deleted */
if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_delete() */
/*-------------------------------------------------------------------------
* Function: H5HL_get_size
@@ -926,13 +958,17 @@ END_FUNC(PRIV) /* end H5HL_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size))
+herr_t
+H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size)
+{
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
+ H5HL_t * heap = NULL; /* Heap data structure */
+ herr_t ret_value = SUCCEED;
- H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
- H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
- H5HL_t * heap = NULL; /* Heap data structure */
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(size);
@@ -946,7 +982,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -954,11 +990,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add
/* Set the size to return */
*size = heap->dblk_size;
- CATCH
+done:
if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_get_size() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_get_size() */
/*-------------------------------------------------------------------------
* Function: H5HL_heapsize
@@ -973,13 +1010,17 @@ END_FUNC(PRIV) /* end H5HL_get_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size))
+herr_t
+H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size)
+{
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
+ H5HL_t * heap = NULL; /* Heap data structure */
+ herr_t ret_value = SUCCEED;
- H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
- H5HL_prfx_t * prfx = NULL; /* Local heap prefix */
- H5HL_t * heap = NULL; /* Heap data structure */
+ FUNC_ENTER_NOAPI(FAIL)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(heap_size);
@@ -993,7 +1034,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add
/* Protect the local heap prefix */
if (NULL ==
(prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix");
/* Get the pointer to the heap */
heap = prfx->heap;
@@ -1001,8 +1042,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add
/* Accumulate the size of the local heap */
*heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size);
- CATCH
+done:
if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix");
-END_FUNC(PRIV) /* end H5HL_heapsize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_heapsize() */