summaryrefslogtreecommitdiffstats
path: root/src/H5HLprfx.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-05-29 02:58:13 (GMT)
committerGitHub <noreply@github.com>2021-05-29 02:58:13 (GMT)
commit552ce4952b48c6c16d51023d0e30daa823706dc3 (patch)
tree6bca5cc6aa2361d5e6cf45c63cd154bb7c350e5c /src/H5HLprfx.c
parent0262a49f9c6b687b38a2527ef75763d8f8e68a1c (diff)
downloadhdf5-552ce4952b48c6c16d51023d0e30daa823706dc3.zip
hdf5-552ce4952b48c6c16d51023d0e30daa823706dc3.tar.gz
hdf5-552ce4952b48c6c16d51023d0e30daa823706dc3.tar.bz2
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>
Diffstat (limited to 'src/H5HLprfx.c')
-rw-r--r--src/H5HLprfx.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c
index 90f6c74..03e3999 100644
--- a/src/H5HLprfx.c
+++ b/src/H5HLprfx.c
@@ -80,20 +80,24 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap))
+H5HL_prfx_t *
+H5HL__prfx_new(H5HL_t *heap)
+{
+ H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ H5HL_prfx_t *ret_value = NULL;
- H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
/* Allocate new local heap prefix */
if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap prefix")
/* Increment ref. count on heap data structure */
if (FAIL == H5HL__inc_rc(heap))
- H5E_THROW(H5E_CANTINC, "can't increment heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the prefix */
prfx->heap = heap;
@@ -102,13 +106,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap))
/* Set the return value */
ret_value = prfx;
- CATCH
+done:
/* Ensure that the prefix memory is deallocated on errors */
if (!ret_value && prfx != NULL)
/* H5FL_FREE always returns NULL so we can't check for errors */
prfx = H5FL_FREE(H5HL_prfx_t, prfx);
-END_FUNC(PKG) /* end H5HL__prfx_new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__prfx_new() */
/*-------------------------------------------------------------------------
* Function: H5HL__prfx_dest
@@ -122,7 +127,12 @@ END_FUNC(PKG) /* end H5HL__prfx_new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx))
+herr_t
+H5HL__prfx_dest(H5HL_prfx_t *prfx)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(prfx);
@@ -134,15 +144,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx))
/* Decrement ref. count on heap data structure */
if (FAIL == H5HL__dec_rc(prfx->heap))
- H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from prefix */
prfx->heap = NULL;
- } /* end if */
+ }
- CATCH
+done:
/* Free prefix memory */
/* H5FL_FREE always returns NULL so we can't check for errors */
prfx = H5FL_FREE(H5HL_prfx_t, prfx);
-END_FUNC(PKG) /* end H5HL__prfx_dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__prfx_dest() */