summaryrefslogtreecommitdiffstats
path: root/src/H5EA.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-01 16:05:56 (GMT)
committerGitHub <noreply@github.com>2021-06-01 16:05:56 (GMT)
commit7dded355b89ea66451955ee188841dcd14860c82 (patch)
tree561792e0e3af7529c8a5e6a9782bc7ddfbf8eb94 /src/H5EA.c
parent62868dabe1010a7b73a37fc7020ab19ced7571a7 (diff)
downloadhdf5-7dded355b89ea66451955ee188841dcd14860c82.zip
hdf5-7dded355b89ea66451955ee188841dcd14860c82.tar.gz
hdf5-7dded355b89ea66451955ee188841dcd14860c82.tar.bz2
VFD SWMR: Sync with develop (#711)
* Brings CMake updates from develop * Brings reduction in pedantic casts from develop * Purges UFAIL from the library (#637) * Committing clang-format changes * Purges UFAIL from the library * H5HL_insert change requested in PR Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes gratuitous (double)x.yF casts (#632) * Committing clang-format changes * Removes gratuitous (double)x.yF casts * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Committing clang-format changes * Cleans up a const warning left over from previous constification (#633) * Committing clang-format changes * Adds consts to a few global variables * Cleans up a const warning left over from previous constification Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Formatted source * Bring over some VOL registration changes * VOL cleanup * H5VL_request_status_t substitutions * H5F.c cleanup * Minor API tweaks from develop * Moves H5G package init/teardown to H5Gint.c * H5G cleanup * H5M cleanup * H5SM cleanup * H5T cleanup * H5R cleanup * H5Lpublic.h cleanup * H5L cleanup * H5O cleanup * H5A, H5CS, and H5AC cleanup * Moved H5A init/teardown code to H5Aint.c * Moves H5D I/O functions to H5D.c * H5D cleanup * Misc minor cleanup * H5P close cleanup * H5Tpublic.h cleanup * Fixes err_compat test * H5PLpublic.h cleanup * Updates H5Ppublic.h * H5Fpublic.h updates * H5A.c cleanup * Brings over H5Aexists and related changes * Brings CMake shell testing changes from develop * Close callback changes * H5R and H5Tcommit normalization * err_compat test works now * H5O tweaks * Updates VOL registration code * Brings over H5VL_create_object * H5Tconv.c reformatting * H5T.c tweaks * Brings datatype and reference updates from develop * Brings VOL plugin loading changes from develop * Brings event sets from develop * Brings async functions over * Tools changes * Brings over many tools changes from develop * Brings VOL flags from develop * Fixes h5dump double/float tests * Updates h5repack tests * Brings h5diff test changes from develop * Last h5dump changes * Brings test changes from develop * Committing clang-format changes * Tidied h5_testing() * Brings chunk iteration code + misc from develop * Updates vds test * Enables external link parallel test * Brings updated property lists from develop * H5G changes from develop * H5MF cleanup * Brings vfd_swmr test back into CMake * Updates threadsafe test * Updates plist test * Brings recent changes from develop * Require a C++11 compiler to build the C++ wrappers (#693) * Committing clang-format changes * Requires a C++11 compiler to build the C++ wrappers Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix H5FD_mpio_Debug="rw" can report MPI_count instead of bytes (#699) * Removes pre-C99 build and header cruft (#700) * Assumes ANSI C headers exist * Assumes stdbool.h, stdint.h, and inttypes.h are present * Assumes the C++ compiler can handle stdint.h * Removes all work-arounds for missing functionality, especially stdbool.h Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Updates release documents * Brings parallel changes from develop * Adds a VFD/parallel check program for the VFD SWMR shell test * Updates MANIFEST * Disable building VFD SWMR acceptance tests on CMake * Removes err.h from genall5.c * Partial cleanup of H5Cpkg.h * Fixes printf specifiers in H5Cdbg.c * Java and fortran cmake changes (#694) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call * TRILAB-227 Enable test * Quote subset args * Use MATCHES because of AppleClang * if blocks needed for build modes * Update list of DT platforms * VS2019 correctly displays float values * revert VS2019 change * Issue #669 remove version from pkgcfg filename * remove version from h5cc script * Java reference functions updated enabled fortran in cmake gcc action yaml file java reference test changed to correctly test refs jni reference functions that create ids changed to use jni id logging * Correct BYPRODUCTS argument * Correct more genereated files BYPRODUCTS * BYPRODUCTS must have unique locations * Fix typo 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> * Split H5L.c internal code to H5Lint.c (#691) * Committing clang-format changes * Splits internal parts of H5L.c to H5Lint.c Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Clean up type size checks in configure.ac (#702) * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5EA.c')
-rw-r--r--src/H5EA.c410
1 files changed, 218 insertions, 192 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index 4d6b7c1..8f9a4b6 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -116,39 +116,40 @@ H5FL_BLK_DEFINE(ea_native_elmt);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL,
- H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata))
+static H5EA_t *
+H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata)
+{
+ H5EA_t * ea = NULL; /* Pointer to new extensible array */
+ H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
+ H5EA_t * ret_value = NULL;
- /* Local variables */
- H5EA_t * ea = NULL; /* Pointer to new extensible array */
- H5EA_hdr_t *hdr = NULL; /* The extensible array header information */
+ FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Allocate extensible array wrapper */
if (NULL == (ea = H5FL_CALLOC(H5EA_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for extensible array info")
/* Lock the array header into memory */
if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to load extensible array header")
/* Check for pending array deletion */
if (from_open && hdr->pending_delete)
- H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTOPENOBJ, NULL, "can't open extensible array pending deletion")
/* Point extensible array wrapper at header and bump it's ref count */
ea->hdr = hdr;
if (H5EA__hdr_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
/* Increment # of files using this array header */
if (H5EA__hdr_fuse_incr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared array header")
/* Set file pointer for this array open context */
ea->f = f;
@@ -156,15 +157,16 @@ BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL,
/* Set the return value */
ret_value = ea;
- CATCH
+done:
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to release extensible array header")
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(STATIC) /* end H5EA__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__new() */
/*-------------------------------------------------------------------------
* Function: H5EA_create
@@ -179,16 +181,16 @@ END_FUNC(STATIC) /* end H5EA__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL,
- H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
-
- /* Local variables */
+H5EA_t *
+H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)
+{
H5EA_t *ea = NULL; /* Pointer to new extensible array */
haddr_t ea_addr; /* Array header address */
+ H5EA_t *ret_value = NULL;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(cparam);
@@ -197,22 +199,23 @@ BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL,
/* Create extensible array header */
if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create extensible array header")
/* Allocate and initialize new extensible array wrapper */
if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for extensible array wrapper")
/* Set the return value */
ret_value = ea;
- CATCH
-
+done:
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_create() */
/*-------------------------------------------------------------------------
* Function: H5EA_open
@@ -227,31 +230,33 @@ END_FUNC(PRIV) /* end H5EA_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
+H5EA_t *
+H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata)
+{
+ H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
+ H5EA_t *ret_value = NULL;
- /* Local variables */
- H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
+ FUNC_ENTER_NOAPI(NULL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Allocate and initialize new extensible array wrapper */
if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for extensible array wrapper")
/* Set the return value */
ret_value = ea;
- CATCH
-
+done:
if (!ret_value)
if (ea && H5EA_close(ea) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array")
+ HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array")
-END_FUNC(PRIV) /* end H5EA_open() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_open() */
/*-------------------------------------------------------------------------
* Function: H5EA_get_nelmts
@@ -265,20 +270,20 @@ END_FUNC(PRIV) /* end H5EA_open() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts))
-
- /* Local variables */
+herr_t
+H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(nelmts);
/* Retrieve the max. index set */
*nelmts = ea->hdr->stats.stored.max_idx_set;
-END_FUNC(PRIV) /* end H5EA_get_nelmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_nelmts() */
/*-------------------------------------------------------------------------
* Function: H5EA_get_addr
@@ -292,13 +297,12 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, haddr_t *addr))
-
- /* Local variables */
+herr_t
+H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(ea->hdr);
HDassert(addr);
@@ -306,7 +310,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, hadd
/* Retrieve the address of the extensible array's header */
*addr = ea->hdr->addr;
-END_FUNC(PRIV) /* end H5EA_get_addr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_addr() */
/*-------------------------------------------------------------------------
* Function: H5EA__lookup_elmt
@@ -321,12 +326,11 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc,
- void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
- H5EA__unprotect_func_t *thing_unprot_func))
-
- /* Local variables */
+static herr_t
+H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned thing_acc, void **thing,
+ uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx,
+ H5EA__unprotect_func_t *thing_unprot_func)
+{
H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */
H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */
H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */
@@ -336,10 +340,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */
hbool_t stats_changed = FALSE; /* Whether array statistics changed */
hbool_t hdr_dirty = FALSE; /* Whether the array header changed */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_STATIC
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
HDassert(thing);
@@ -365,17 +370,18 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Create the index block */
hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed);
if (!H5F_addr_defined(hdr->idx_blk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create index block")
hdr_dirty = TRUE;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu",
- (unsigned long long)hdr->idx_blk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Check if element is in index block */
if (idx < hdr->cparam.idx_blk_elmts) {
@@ -416,21 +422,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off,
hdr->sblk_info[sblk_idx].dblk_nelmts);
if (!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array data block")
/* Set data block address in index block */
iblock->dblk_addrs[dblk_idx] = dblk_addr;
iblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx],
hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)iblock->dblk_addrs[dblk_idx])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)iblock->dblk_addrs[dblk_idx])
/* Adjust index to offset in data block */
elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts;
@@ -438,9 +446,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check if there is already a dependency on the header */
if (will_extend && !dblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block and header, index = %llu",
- (unsigned long long)idx)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block and header, index = %llu",
+ (unsigned long long)idx)
dblock->has_hdr_depend = TRUE;
} /* end if */
@@ -465,21 +474,23 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Create super block */
sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx);
if (!H5F_addr_defined(sblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array super block")
/* Set super block address in index block */
iblock->sblk_addrs[sblk_off] = sblk_addr;
iblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect super block */
if (NULL == (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx,
thing_acc)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)iblock->sblk_addrs[sblk_off])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)iblock->sblk_addrs[sblk_off])
/* Compute the data block index in super block */
dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts);
@@ -498,7 +509,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
dblk_addr =
H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts);
if (!H5F_addr_defined(dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array data block")
/* Set data block address in index block */
sblock->dblk_addrs[dblk_idx] = dblk_addr;
@@ -508,8 +520,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
*/
if (will_extend && !sblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between super block and header, address "
"= %llu",
(unsigned long long)sblock->addr)
@@ -517,7 +529,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
} /* end if */
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Adjust index to offset in data block */
@@ -548,29 +560,29 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */
/* Create the data block page */
if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0)
- H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page")
/* Mark data block page as initialized in super block */
H5VM_bit_set(sblock->page_init, page_init_idx, TRUE);
sblock_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
else
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
/* Protect data block page */
if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Check if there is already a dependency on the header */
if (will_extend && !dblk_page->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block page and header, "
- "index = %llu",
- (unsigned long long)idx)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block page and header, "
+ "index = %llu",
+ (unsigned long long)idx)
dblk_page->has_hdr_depend = TRUE;
} /* end if */
@@ -584,15 +596,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx],
sblock->dblk_nelmts, thing_acc)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect extensible array data block, address = %llu",
- (unsigned long long)sblock->dblk_addrs[dblk_idx])
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)sblock->dblk_addrs[dblk_idx])
/* Check if there is already a dependency on the header */
if (will_extend && !dblock->has_hdr_depend) {
if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block and header, index = %llu",
(unsigned long long)idx)
dblock->has_hdr_depend = TRUE;
@@ -611,7 +623,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
HDassert(*thing != NULL);
HDassert(*thing_unprot_func != NULL);
- CATCH
+done:
/* Reset 'thing' info on error */
if (ret_value < 0) {
*thing = NULL;
@@ -627,20 +639,22 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check for header modified */
if (hdr_dirty)
if (H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL,
+ "unable to mark extensible array header as modified")
/* Release resources */
if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block")
/* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */
if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block")
if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block")
if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block page")
-END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__lookup_elmt() */
/*-------------------------------------------------------------------------
* Function: H5EA_set
@@ -654,9 +668,9 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt))
-
- /* Local variables */
+herr_t
+H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt)
+{
H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
@@ -664,10 +678,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */
hbool_t will_extend; /* Flag indicating if setting the element will extend the array */
unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
@@ -678,7 +693,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
will_extend = (idx >= hdr->stats.stored.max_idx_set);
if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx,
&thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata")
/* Sanity check */
HDassert(thing);
@@ -695,15 +710,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t
/* Update the max index for the array */
hdr->stats.stored.max_idx_set = idx + 1;
if (H5EA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified")
- } /* end if */
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL,
+ "unable to mark extensible array header as modified")
+ }
- CATCH
+done:
/* Release resources */
if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_set() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_set() */
/*-------------------------------------------------------------------------
* Function: H5EA_get
@@ -717,17 +734,18 @@ END_FUNC(PRIV) /* end H5EA_set() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt))
-
- /* Local variables */
+herr_t
+H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt)
+{
H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
H5EA__unprotect_func_t thing_unprot_func =
NULL; /* Function pointer for unprotecting the array metadata */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
@@ -735,7 +753,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
if (idx >= hdr->stats.stored.max_idx_set) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else {
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
@@ -747,13 +765,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
/* Look up the array metadata containing the element we want to set */
if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx,
&thing_unprot_func) < 0)
- H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata")
/* Check if the thing holding the element has been created yet */
if (NULL == thing) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0)
- H5E_THROW(H5E_CANTSET, "can't set element to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else
/* Get element from thing's element buffer */
@@ -761,12 +779,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t
hdr->cparam.cls->nat_elmt_size);
} /* end else */
- CATCH
+done:
/* Release thing */
if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata")
-END_FUNC(PRIV) /* end H5EA_get() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_get() */
/*-------------------------------------------------------------------------
* Function: H5EA_depend
@@ -781,14 +800,15 @@ END_FUNC(PRIV) /* end H5EA_get() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent))
+herr_t
+H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent)
+{
+ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(hdr);
HDassert(parent);
@@ -807,13 +827,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_
/* Add the extensible array as a child of the parent (proxy) */
if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "unable to add extensible array as child of proxy")
hdr->parent = parent;
- } /* end if */
-
- CATCH
+ }
-END_FUNC(PRIV) /* end H5EA_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_depend() */
/*-------------------------------------------------------------------------
* Function: H5EA_close
@@ -827,15 +847,16 @@ END_FUNC(PRIV) /* end H5EA_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
-
- /* Local variables */
+herr_t
+H5EA_close(H5EA_t *ea)
+{
hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(ea);
/* Close the header, if it was set */
@@ -868,8 +889,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
/* Check the header's status in the metadata cache */
if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET,
- "unable to check metadata cache status for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for extensible array header")
/* Sanity checks on header */
HDassert(hdr_status & H5AC_ES__IN_CACHE);
@@ -881,7 +902,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
/* Lock the array header into memory */
/* (OK to pass in NULL for callback context, since we know the header must be in the cache) */
if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTLOAD, FAIL, "unable to load extensible array header")
/* Set the shared array header's file context for this operation */
hdr->f = ea->f;
@@ -891,11 +912,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
* immediately -QAK)
*/
if (H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
/* Delete array, starting with header (unprotects header) */
if (H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array")
} /* end if */
else {
/* Decrement the reference count on the array header */
@@ -903,16 +925,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea))
* immediately -QAK)
*/
if (H5EA__hdr_decr(ea->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
} /* end else */
} /* end if */
/* Release the extensible array wrapper */
ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea);
- CATCH
-
-END_FUNC(PRIV) /* end H5EA_close() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_close() */
/*-------------------------------------------------------------------------
* Function: H5EA_delete
@@ -926,21 +949,22 @@ END_FUNC(PRIV) /* end H5EA_close() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata))
+herr_t
+H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata)
+{
+ H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(ea_addr));
/* Lock the array header into memory */
if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
- (unsigned long long)ea_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
/* Check for files using shared array header */
if (hdr->file_rc)
@@ -951,17 +975,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_ad
/* Delete array now, starting with header (unprotects header) */
if (H5EA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array")
hdr = NULL;
- } /* end if */
+ }
- CATCH
-
- /* Unprotect the header, if an error occurred */
+done:
+ /* Unprotect the header if an error occurred */
if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PRIV) /* end H5EA_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA_iterate
@@ -975,13 +999,14 @@ END_FUNC(PRIV) /* end H5EA_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
- H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
-
- /* Local variables */
+int
+H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)
+{
uint8_t *elmt = NULL;
hsize_t u;
- int cb_ret = H5_ITER_CONT; /* Return value from callback */
+ int ret_value = H5_ITER_CONT;
+
+ FUNC_ENTER_NOAPI(H5_ITER_ERROR)
/* Check arguments */
HDassert(ea);
@@ -990,27 +1015,28 @@ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
/* Allocate space for a native array element */
if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, H5_ITER_ERROR,
+ "memory allocation failed for extensible array element")
/* Iterate over all elements in array */
- for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
+ for (u = 0; u < ea->hdr->stats.stored.max_idx_set && ret_value == H5_ITER_CONT; u++) {
/* Get array element */
if (H5EA_get(ea, u, elmt) < 0)
- H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array")
/* Make callback */
- if ((cb_ret = (*op)(u, elmt, udata)) < 0) {
- H5E_PRINTF(H5E_BADITER, "iterator function failed");
- H5_LEAVE(cb_ret)
- } /* end if */
- } /* end for */
-
- CATCH
+ if ((ret_value = (*op)(u, elmt, udata)) < 0) {
+ HERROR(H5E_EARRAY, H5E_BADITER, "iteration callback error");
+ break;
+ }
+ }
+done:
if (elmt)
elmt = H5FL_BLK_FREE(ea_native_elmt, elmt);
-END_FUNC(PRIV) /* end H5EA_iterate() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA_iterate() */
/*-------------------------------------------------------------------------
* Function: H5EA_patch_file
@@ -1024,17 +1050,17 @@ END_FUNC(PRIV) /* end H5EA_iterate() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_patch_file(H5EA_t *ea, H5F_t *f))
-
- /* Local variables */
+herr_t
+H5EA_patch_file(H5EA_t *ea, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(f);
if (ea->f != f || ea->hdr->f != f)
ea->f = ea->hdr->f = f;
-END_FUNC(PRIV) /* end H5EA_patch_file() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_patch_file() */