summaryrefslogtreecommitdiffstats
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
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>
-rwxr-xr-xbin/trace31
-rw-r--r--src/H5.c4
-rw-r--r--src/H5EA.c410
-rw-r--r--src/H5EAcache.c699
-rw-r--r--src/H5EAdbg.c145
-rw-r--r--src/H5EAdblkpage.c126
-rw-r--r--src/H5EAdblock.c177
-rw-r--r--src/H5EAhdr.c317
-rw-r--r--src/H5EAiblock.c169
-rw-r--r--src/H5EAint.c32
-rw-r--r--src/H5EAsblock.c164
-rw-r--r--src/H5EAstat.c14
-rw-r--r--src/H5EAtest.c183
-rw-r--r--src/H5Eprivate.h47
-rw-r--r--src/H5FA.c337
-rw-r--r--src/H5FAcache.c398
-rw-r--r--src/H5FAdbg.c79
-rw-r--r--src/H5FAdblkpage.c121
-rw-r--r--src/H5FAdblock.c155
-rw-r--r--src/H5FAhdr.c263
-rw-r--r--src/H5FAint.c32
-rw-r--r--src/H5FAstat.c14
-rw-r--r--src/H5FAtest.c129
-rw-r--r--src/H5HL.c392
-rw-r--r--src/H5HLcache.c24
-rw-r--r--src/H5HLdbg.c28
-rw-r--r--src/H5HLdblk.c82
-rw-r--r--src/H5HLint.c60
-rw-r--r--src/H5HLpkg.h2
-rw-r--r--src/H5HLprfx.c33
-rw-r--r--src/H5HLprivate.h2
-rw-r--r--src/H5private.h242
-rw-r--r--tools/lib/h5tools_error.h26
33 files changed, 2674 insertions, 2263 deletions
diff --git a/bin/trace b/bin/trace
index a2052ce..0eef8ce 100755
--- a/bin/trace
+++ b/bin/trace
@@ -283,8 +283,8 @@ my $file_api = 0;
my $file_args = 0;
my $total_api = 0;
my $total_args = 0;
-sub rewrite_func ($$$$$$$$) {
- my ($file, $begin, $type, $aftertype, $name, $args, $close, $body) = @_;
+sub rewrite_func ($$$$$) {
+ my ($file, $type, $name, $args, $body) = @_;
my ($arg, $trace, $argtrace);
my (@arg_name, @arg_str, @arg_type);
local $_;
@@ -459,7 +459,7 @@ sub rewrite_func ($$$$$$$$) {
}
error:
- return "\n$begin$type$aftertype$name($orig_args)$close$body";
+ return "\n$type\n$name($orig_args)\n$body";
}
##############################################################################
@@ -481,25 +481,12 @@ for $file (@ARGV) {
# Make a copy of the original data
my $original = $Source;
- # Check which style of function declaration is used in this file
- if ( $Source =~ /BEGIN_FUNC/ ) {
- # Make modifications
- $Source =~ s/\n(BEGIN_FUNC.*?\n) #begin
- ([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**) #type
- (.*?\n) #aftertype
- (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name
- \s*\((.*?)\)\s* #args
- (\)) #close
- (\n.*?\nEND_FUNC\([^\n]*) #body
- /rewrite_func($file,$1,$2,$4,$5,$6,$7,$8)/segx;
- } else {
- # Make modifications
- $Source =~ s/\n([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**)\n #type
- (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name
- \s*\((.*?)\)\s* #args
- (\{.*?\n\}[^\n]*) #body
- /rewrite_func($file,"",$1,"\n",$3,$4,"\n",$5)/segx;
- }
+ # Make modifications
+ $Source =~ s/\n([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**)\n #type
+ (H5[A-Z]{0,2}_?[a-zA-Z0-9_]\w*) #name
+ \s*\((.*?)\)\s* #args
+ (\{.*?\n\}[^\n]*) #body
+ /rewrite_func($file,$1,$3,$4,$5)/segx;
# If the source changed then print out the new version
if ($original ne $Source) {
diff --git a/src/H5.c b/src/H5.c
index 14a65db..ce4a001 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -70,10 +70,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
-/* HDF5 API Entered variable */
-/* (move to H5.c when new FUNC_ENTER macros in actual use -QAK) */
-hbool_t H5_api_entered_g = FALSE;
-
/* statically initialize block for pthread_once call used in initializing */
/* the first global mutex */
#ifdef H5_HAVE_THREADSAFE
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() */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 2a3153c..eeac1a2 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -221,12 +221,13 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->f);
@@ -235,7 +236,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f);
-END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_verify_chksum
@@ -250,13 +252,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -267,7 +271,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5EA__cache_hdr_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_deserialize
@@ -282,16 +287,17 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_cls_id_t id; /* ID of extensible array class, as found in file */
H5EA_hdr_t * hdr = NULL; /* Extensible array info */
H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata;
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(image);
@@ -301,24 +307,25 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate space for the extensible array data structure */
if (NULL == (hdr = H5EA__hdr_alloc(udata->f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array shared header")
/* Set the extensible array header's address */
hdr->addr = udata->addr;
/* Magic number */
if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_HDR_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array header version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version")
/* Extensible array class */
id = (H5EA_cls_id_t)*image++;
if (id >= H5EA_NUM_CLS_ID)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
hdr->cparam.cls = H5EA_client_class_g[id];
/* General array creation/configuration information */
@@ -379,20 +386,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Finish initializing extensible array header */
if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header")
HDassert(hdr->size == len);
/* Set return value */
ret_value = hdr;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header")
-END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_image_len
@@ -406,12 +413,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -419,7 +427,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = hdr->size;
-END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_serialize
@@ -433,14 +442,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ FUNC_ENTER_STATIC_NOERR
+
/* check arguments */
HDassert(f);
HDassert(image);
@@ -488,7 +498,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_hdr_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_notify
@@ -502,11 +513,13 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(hdr);
@@ -538,23 +551,24 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on object header proxy */
if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent,
(void *)hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between extensible array and proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between extensible array and proxy")
hdr->parent = NULL;
} /* end if */
/* Detach from 'top' proxy for extensible array */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between header and "
+ "extensible array 'top' proxy")
/* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
} /* end if */
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
@@ -563,9 +577,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
else
HDassert(NULL == hdr->parent);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_hdr_free_icr
@@ -580,18 +594,23 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing))
+static herr_t
+H5EA__cache_hdr_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array header */
if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_hdr_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_get_initial_load_size
@@ -605,13 +624,14 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
H5EA_iblock_t iblock; /* Fake index block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -626,7 +646,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock);
-END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_iblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_verify_chksum
@@ -641,13 +662,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -658,7 +681,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_deserialize
@@ -673,17 +697,18 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_iblock_t *iblock = NULL; /* Index block info */
H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
size_t u; /* Local index variable */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(image);
@@ -691,28 +716,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array index block */
if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array index block")
/* Set the extensible array index block's address */
iblock->addr = hdr->idx_blk_addr;
/* Magic number */
if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_IBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array index block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version")
/* Extensible array type */
if (*image++ != (uint8_t)hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Internal information */
@@ -721,7 +747,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) <
0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements")
image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size);
} /* end if */
@@ -757,14 +783,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = iblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block")
-END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_image_len
@@ -778,12 +804,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(iblock);
HDassert(image_len);
@@ -791,7 +818,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = iblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_iblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_serialize
@@ -805,14 +833,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(f);
@@ -843,7 +872,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts,
iblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements")
image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -874,9 +903,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_notify
@@ -890,11 +919,13 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(iblock);
@@ -905,9 +936,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on extensible array header */
if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between index block and header, address = %llu",
- (unsigned long long)iblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
@@ -923,30 +955,32 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on extensible array header */
if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between index block and header, address = %llu",
- (unsigned long long)iblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between index block and header, address = %llu",
+ (unsigned long long)iblock->addr)
/* Detach from 'top' proxy for extensible array */
if (iblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between index block and "
+ "extensible array 'top' proxy")
iblock->top_proxy = NULL;
} /* end if */
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_iblock_free_icr
@@ -961,18 +995,23 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_iblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array index block */
if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_iblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_get_initial_load_size
@@ -986,13 +1025,14 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
H5EA_sblock_t sblock; /* Fake super block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1026,7 +1066,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock);
-END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_verify_chksum
@@ -1041,13 +1082,15 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1058,7 +1101,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_deserialize
@@ -1073,17 +1117,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_sblock_t * sblock = NULL; /* Super block info */
H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
size_t u; /* Local index variable */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -1094,28 +1139,29 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array super block */
if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array super block")
/* Set the extensible array super block's address */
sblock->addr = udata->sblk_addr;
/* Magic number */
if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_SBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array super block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version")
/* Extensible array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Offset of block within the array's address space */
UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size);
@@ -1154,14 +1200,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = sblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block")
-END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_image_len
@@ -1175,12 +1221,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(sblock);
HDassert(image_len);
@@ -1188,7 +1235,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = sblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_serialize
@@ -1202,16 +1250,16 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
size_t u; /* Local index variable */
+ FUNC_ENTER_STATIC_NOERR
+
/* check arguments */
HDassert(f);
HDassert(image);
@@ -1260,7 +1308,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_sblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_notify
@@ -1274,11 +1323,13 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(sblock);
@@ -1289,8 +1340,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on index block */
if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (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 index block, address = %llu",
(unsigned long long)sblock->addr)
break;
@@ -1299,8 +1350,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on extensible array header, if set */
if (sblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and header, address = %llu",
(unsigned long long)sblock->addr)
sblock->has_hdr_depend = FALSE;
@@ -1310,16 +1361,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on index block */
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and index block, address = %llu",
(unsigned long long)sblock->addr)
/* Destroy flush dependency on extensible array header, if set */
if (sblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between super block and header, address = %llu",
(unsigned long long)sblock->addr)
sblock->has_hdr_depend = FALSE;
@@ -1328,8 +1379,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for extensible array */
if (sblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between super block and "
+ "extensible array 'top' proxy")
sblock->top_proxy = NULL;
} /* end if */
break;
@@ -1345,15 +1397,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_sblock_free_icr
@@ -1368,18 +1420,23 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_sblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array super block */
if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_get_initial_load_size
@@ -1393,13 +1450,14 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
H5EA_dblock_t dblock; /* Fake data block for computing size */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1434,7 +1492,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock);
-END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_verify_chksum
@@ -1449,13 +1508,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1466,7 +1527,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_sblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_deserialize
@@ -1481,16 +1543,18 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_dblock_t * dblock = NULL; /* Data block info */
H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(udata);
@@ -1501,7 +1565,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array data block */
if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block")
HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) ||
(len == H5EA_DBLOCK_PREFIX_SIZE(dblock)));
@@ -1511,21 +1576,21 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Magic number */
if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5EA_DBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong extensible array data block version")
+ HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version")
/* Extensible array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address")
/* Offset of block within the array's address space */
UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size);
@@ -1537,7 +1602,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Decode elements in data block */
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements")
image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1560,14 +1625,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblock;
- CATCH
+done:
/* Release resources */
if (!ret_value)
if (dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block")
-END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5EA__cache_dblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_image_len
@@ -1581,12 +1647,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(image_len);
@@ -1597,7 +1664,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock);
-END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_serialize
@@ -1611,14 +1679,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(f);
@@ -1651,7 +1720,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements")
image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size);
} /* end if */
@@ -1664,9 +1733,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_notify
@@ -1680,11 +1749,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(dblock);
@@ -1695,17 +1766,17 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTDEPEND,
- "unable to create flush dependency between data block and parent, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL,
+ "unable to create flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
break;
case H5AC_NOTIFY_ACTION_AFTER_FLUSH:
/* Destroy flush dependency on extensible array header, if set */
if (dblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between direct block and header, address = %llu",
(unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
@@ -1715,15 +1786,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block and parent, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block and parent, address = %llu",
+ (unsigned long long)dblock->addr)
/* Destroy flush dependency on extensible array header, if set */
if (dblock->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between data block and header, address = %llu",
(unsigned long long)dblock->addr)
dblock->has_hdr_depend = FALSE;
@@ -1732,8 +1804,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for extensible array */
if (dblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block and "
+ "extensible array 'top' proxy")
dblock->top_proxy = NULL;
} /* end if */
break;
@@ -1749,15 +1822,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_free_icr
@@ -1772,18 +1845,23 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing))
+static herr_t
+H5EA__cache_dblock_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array data block */
if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block")
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblock_fsf_size
@@ -1814,12 +1892,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)
+{
const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -1828,7 +1907,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
*fsf_size = dblock->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblock_fsf_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_get_initial_load_size
@@ -1842,12 +1922,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -1856,7 +1937,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr);
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblk_page_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_verify_chksum
@@ -1871,13 +1953,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1888,7 +1972,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_deserialize
@@ -1903,16 +1988,17 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */
H5EA_dblk_page_cache_ud_t *udata =
(H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -1922,7 +2008,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the extensible array data block page */
if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block page")
/* Set the extensible array data block page's information */
dblk_page->addr = udata->dblk_page_addr;
@@ -1933,7 +2020,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts,
udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements")
image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size);
/* Sanity check */
@@ -1954,14 +2041,13 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblk_page;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_image_len
@@ -1975,12 +2061,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)
+{
const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblk_page);
HDassert(image_len);
@@ -1988,7 +2075,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = dblk_page->size;
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__cache_dblk_page_image_len() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_serialize
@@ -2002,14 +2090,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image,
- size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing)
+{
H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(f);
@@ -2024,7 +2114,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts,
dblk_page->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements")
image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size);
/* Compute metadata checksum */
@@ -2036,9 +2126,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_serialize() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_notify
@@ -2052,11 +2142,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
+static herr_t
+H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)
+{
H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblk_page);
@@ -2067,8 +2159,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block page and parent, address = %llu",
(unsigned long long)dblk_page->addr)
break;
@@ -2077,10 +2169,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on extensible array header, if set */
if (dblk_page->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block page and header, "
- "address = %llu",
- (unsigned long long)dblk_page->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and header, "
+ "address = %llu",
+ (unsigned long long)dblk_page->addr)
dblk_page->has_hdr_depend = FALSE;
} /* end if */
break;
@@ -2088,27 +2180,27 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between data block page and parent, address = %llu",
(unsigned long long)dblk_page->addr)
/* Destroy flush dependency on extensible array header, if set */
if (dblk_page->has_hdr_depend) {
if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block page and header, "
- "address = %llu",
- (unsigned long long)dblk_page->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and header, "
+ "address = %llu",
+ (unsigned long long)dblk_page->addr)
dblk_page->has_hdr_depend = FALSE;
} /* end if */
/* Detach from 'top' proxy for extensible array */
if (dblk_page->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between data block page and "
- "extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page and "
+ "extensible array 'top' proxy")
dblk_page->top_proxy = NULL;
} /* end if */
break;
@@ -2124,15 +2216,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_notify() */
/*-------------------------------------------------------------------------
* Function: H5EA__cache_dblk_page_free_icr
@@ -2147,15 +2239,20 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing))
+static herr_t
+H5EA__cache_dblk_page_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array data block page */
if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page")
-END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cache_dblk_page_free_icr() */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 72d2f38..b0e564c 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -79,13 +79,16 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t obj_addr))
-
+herr_t
+H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
- void * dbg_ctx = NULL; /* Extensible array debugging context */
+ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ void * dbg_ctx = NULL; /* Extensible array debugging context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Header...\n", indent, "");
@@ -137,13 +140,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Index Block Address:", hdr->idx_blk_addr);
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
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(PKG) /* end H5EA__hdr_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_debug
@@ -157,14 +161,17 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
-
+herr_t
+H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth,
+ const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- void * dbg_ctx = NULL; /* Extensible array context */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -180,19 +187,20 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Sanity check */
HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr));
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG)))
- 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)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, "");
@@ -216,7 +224,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) <
0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
} /* end if */
@@ -250,15 +258,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
} /* end for */
} /* end if */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 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")
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(PKG) /* end H5EA__iblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_debug
@@ -272,14 +281,17 @@ END_FUNC(PKG) /* end H5EA__iblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr))
-
+herr_t
+H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- void * dbg_ctx = NULL; /* Extensible array context */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -295,18 +307,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Protect super block */
/* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */
if (NULL ==
(sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, "");
@@ -334,15 +347,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
} /* end for */
} /* end if */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 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 (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(PKG) /* end H5EA__sblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_debug
@@ -356,16 +370,18 @@ END_FUNC(PKG) /* end H5EA__sblock_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts,
- haddr_t obj_addr))
-
+herr_t
+H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
+ haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr)
+{
/* Local variables */
- H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- void * dbg_ctx = NULL; /* Extensible array context */
- size_t u; /* Local index variable */
+ H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ void * dbg_ctx = NULL; /* Extensible array context */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -382,17 +398,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context")
/* Load the extensible array header */
if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header")
/* Protect data block */
/* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */
if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR,
- addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %" PRIuHADDR, addr)
/* Print opening message */
HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, "");
@@ -407,15 +423,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Call the class's 'debug' callback */
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context")
if (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 (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(PKG) /* end H5EA__dblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_debug() */
diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c
index b42599c..c0a92f0 100644
--- a/src/H5EAdblkpage.c
+++ b/src/H5EAdblkpage.c
@@ -84,22 +84,25 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
- H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent))
-
- /* Local variables */
+H5EA_dblk_page_t *
+H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent)
+{
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
+ H5EA_dblk_page_t *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the data block */
if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block page")
/* Share common array information */
if (H5EA__hdr_incr(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")
dblk_page->hdr = hdr;
/* Set non-zero internal fields */
@@ -107,17 +110,19 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
/* Allocate buffer for elements in data block page */
if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block page element buffer")
/* Set the return value */
ret_value = dblk_page;
- CATCH
+done:
if (!ret_value)
if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page")
-END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_create
@@ -131,19 +136,22 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr))
-
- /* Local variables */
+herr_t
+H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr)
+{
H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */
hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Allocate the data block page */
if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for extensible array data block page")
/* Set info about data block page on disk */
dblk_page->addr = addr;
@@ -151,34 +159,39 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Clear any elements in data block page to fill value */
if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL,
+ "can't set extensible array data block page elements to class's fill value")
/* Cache the new extensible array data block page */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, FAIL, "can't add extensible array data block page to cache")
inserted = TRUE;
/* Add data block page as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL,
+ "unable to add extensible array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
- CATCH
+done:
if (ret_value < 0)
if (dblk_page) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblk_page) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, FAIL,
+ "unable to remove extensible array data block page from cache")
/* Destroy data block page */
if (H5EA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to destroy extensible array data block page")
} /* end if */
-END_FUNC(PKG) /* end H5EA__dblk_page_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_protect
@@ -193,13 +206,14 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
- H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr,
- unsigned flags))
-
- /* Local variables */
+H5EA_dblk_page_t *
+H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr, unsigned flags)
+{
H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */
H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
+ H5EA_dblk_page_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -216,32 +230,34 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL,
/* Protect the data block page */
if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr,
&udata, flags)))
- 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, NULL,
+ "unable to protect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblk_page->top_proxy) {
/* Add data block page as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block page, if it was protected */
if (dblk_page &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT,
- "unable to unprotect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
} /* end if */
-
-END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_unprotect
@@ -256,22 +272,25 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags))
+herr_t
+H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
/* Unprotect the data block page */
if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
-END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblk_page_dest
@@ -285,7 +304,12 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page))
+herr_t
+H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
@@ -297,13 +321,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_
if (dblk_page->elmts) {
/* Free buffer for data block page elements */
if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to free extensible array data block element buffer")
dblk_page->elmts = NULL;
} /* end if */
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(dblk_page->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")
dblk_page->hdr = NULL;
} /* end if */
@@ -313,6 +339,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_
/* Free the data block page itself */
dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__dblk_page_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblk_page_dest() */
diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c
index 45696c7..f17aae3 100644
--- a/src/H5EAdblock.c
+++ b/src/H5EAdblock.c
@@ -85,11 +85,13 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
- H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts))
+H5EA_dblock_t *
+H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ H5EA_dblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -98,11 +100,12 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
/* Allocate memory for the data block */
if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array data block")
/* Share common array information */
if (H5EA__hdr_incr(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")
dblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -118,18 +121,20 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
else {
/* Allocate buffer for elements in data block */
if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block element buffer")
} /* end else */
/* Set the return value */
ret_value = dblock;
- CATCH
+done:
if (!ret_value)
if (dblock && H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block")
-END_FUNC(PKG) /* end H5EA__dblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_create
@@ -143,14 +148,15 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off,
- size_t nelmts))
+haddr_t
+H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ haddr_t dblock_addr; /* Extensible array data block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
- haddr_t dblock_addr; /* Extensible array data block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -159,7 +165,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the data block */
if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array data block")
/* Set size of data block on disk */
dblock->size = H5EA_DBLOCK_SIZE(dblock);
@@ -169,24 +176,27 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate space for the data block on disk */
if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array data block")
dblock->addr = dblock_addr;
/* Don't initialize elements if paged */
if (!dblock->npages)
/* Clear any elements in data block to fill value */
if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set extensible array data block elements to class's fill value")
/* Cache the new extensible array data block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array data block to cache")
inserted = TRUE;
/* Add data block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -203,25 +213,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of data block to return */
ret_value = dblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (dblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array data block from cache")
/* Release data block's disk space */
if (H5F_addr_defined(dblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release extensible array data block")
/* Destroy data block */
if (H5EA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array data block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__dblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_sblk_idx
@@ -236,10 +250,12 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx))
+unsigned
+H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)
+{
+ unsigned sblk_idx = 0; /* Which superblock does this index fall in? */
- /* Local variables */
- unsigned sblk_idx; /* Which superblock does this index fall in? */
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -252,10 +268,8 @@ BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *h
H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t);
sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1));
- /* Set return value */
- ret_value = sblk_idx;
-
-END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
+ FUNC_LEAVE_NOAPI(sblk_idx)
+} /* end H5EA__dblock_sblk_idx() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_protect
@@ -269,13 +283,14 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
- H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts,
- unsigned flags))
-
- /* Local variables */
+H5EA_dblock_t *
+H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts, unsigned flags)
+{
H5EA_dblock_t * dblock; /* Extensible array data block */
H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ H5EA_dblock_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -294,32 +309,36 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL,
/* Protect the data block */
if (NULL ==
(dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblock->top_proxy) {
/* Add data block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
- } /* end if */
+ }
/* Set return value */
ret_value = dblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block, if it was protected */
if (dblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
- (unsigned long long)dblock->addr)
- } /* end if */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
+ }
-END_FUNC(PKG) /* end H5EA__dblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_unprotect
@@ -333,22 +352,26 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags))
+herr_t
+H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
/* Unprotect the data block */
if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu",
- (unsigned long long)dblock->addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array data block, address = %llu",
+ (unsigned long long)dblock->addr)
- CATCH
+done:
-END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_delete
@@ -362,11 +385,13 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts))
+herr_t
+H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts)
+{
+ H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_dblock_t *dblock = NULL; /* Pointer to data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -376,8 +401,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Protect data block */
if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array data block, address = %llu",
+ (unsigned long long)dblk_addr)
/* Check if this is a paged data block */
if (dblk_nelmts > hdr->dblk_page_nelmts) {
@@ -395,20 +421,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Evict the data block page from the metadata cache */
/* (OK to call if it doesn't exist in the cache) */
if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTEXPUNGE, FAIL,
+ "unable to remove array data block page from metadata cache")
/* Advance to next page address */
dblk_page_addr += dblk_page_size;
} /* end for */
} /* end if */
- CATCH
+done:
/* Finished deleting data block in metadata cache */
if (dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 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")
-END_FUNC(PKG) /* end H5EA__dblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__dblock_dest
@@ -422,7 +450,12 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dblock))
+herr_t
+H5EA__dblock_dest(H5EA_dblock_t *dblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
@@ -435,14 +468,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl
/* Free buffer for data block elements */
HDassert(dblock->nelmts > 0);
if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL,
+ "unable to free extensible array data block element buffer")
dblock->elmts = NULL;
dblock->nelmts = 0;
} /* end if */
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(dblock->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")
dblock->hdr = NULL;
} /* end if */
@@ -452,6 +487,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dbl
/* Free the data block itself */
dblock = H5FL_FREE(H5EA_dblock_t, dblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__dblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__dblock_dest() */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 7f142af..2c68949 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -102,17 +102,21 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f))
+H5EA_hdr_t *
+H5EA__hdr_alloc(H5F_t *f)
+{
+ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ H5EA_hdr_t *ret_value = NULL;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
/* Allocate space for the shared information */
if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array shared header")
/* Set non-zero internal fields */
hdr->addr = HADDR_UNDEF;
@@ -126,12 +130,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f))
/* Set the return value */
ret_value = hdr;
- CATCH
+done:
if (!ret_value)
if (hdr && H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_init
@@ -168,12 +173,15 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata))
-
- /* Local variables */
+herr_t
+H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)
+{
hsize_t start_idx; /* First element index for each super block */
hsize_t start_dblk; /* First data block index for each super block */
size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -188,7 +196,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Allocate information for each super block */
if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, "memory allocation failed for super block info array")
/* Compute information about each super block */
start_idx = 0;
@@ -202,7 +210,7 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Advance starting indices for next super block */
start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts;
start_dblk += (hsize_t)hdr->sblk_info[u].ndblks;
- } /* end for */
+ }
/* Set size of header on disk (locally and in statistics) */
hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr);
@@ -210,12 +218,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void
/* Create the callback context, if there's one */
if (hdr->cparam.cls->crt_context) {
if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create extensible array client callback context")
+ }
-END_FUNC(PKG) /* end H5EA__hdr_init() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_init() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_alloc_elmts
@@ -229,11 +238,14 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts))
-
- /* Local variables */
+void *
+H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)
+{
void * elmts = NULL; /* Element buffer allocated */
unsigned idx; /* Index of element buffer factory in header */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -251,8 +263,8 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr,
/* Re-allocate array of element factories */
if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc)))
- H5E_THROW(H5E_CANTALLOC,
- "memory allocation failed for data block data element buffer factory array")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block data element buffer factory array")
/* Zero out new elements allocated */
HDmemset(new_fac + hdr->elmt_fac.nalloc, 0,
@@ -266,22 +278,24 @@ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr,
/* Check for un-initialized factory at index */
if (NULL == hdr->elmt_fac.fac[idx]) {
if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create data block data element buffer factory")
} /* end if */
/* Allocate buffer for elements in index block */
if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx])))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block data element buffer")
/* Set the return value */
ret_value = elmts;
- CATCH
+done:
if (!ret_value)
if (elmts)
elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_alloc_elmts() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_free_elmts
@@ -295,11 +309,13 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts))
-
- /* Local variables */
+herr_t
+H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)
+{
unsigned idx; /* Index of element buffer factory in header */
+ FUNC_ENTER_PACKAGE_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(nelmts > 0);
@@ -314,26 +330,30 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr,
HDassert(hdr->elmt_fac.fac[idx]);
elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts);
-END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__hdr_free_elmts() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_create
*
* Purpose: Creates a new extensible array header in the file
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Address of new header in the file
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Jun 17 2008
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata))
+haddr_t
+H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)
+{
+ H5EA_hdr_t *hdr = NULL; /* Extensible array header */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Extensible array header */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -347,39 +367,45 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Check for valid parameters */
if (cparam->raw_elmt_size == 0)
- H5E_THROW(H5E_BADVALUE, "element size must be greater than zero")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero")
if (cparam->max_nelmts_bits == 0)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements bits must be greater than zero")
if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u",
- (unsigned)H5EA_MAX_NELMTS_IDX_MAX)
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "max. # of elements bits must be <= %u",
+ (unsigned)H5EA_MAX_NELMTS_IDX_MAX)
if (cparam->sup_blk_min_data_ptrs < 2)
- H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of data block pointers in super block must be >= two")
if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs))
- H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of data block pointers in super block must be power of two")
if (!POWER_OF_TWO(cparam->data_blk_min_elmts))
- H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "min # of elements per data block must be power of two")
dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits;
if (dblk_page_nelmts < cparam->idx_blk_elmts)
- H5E_THROW(H5E_BADVALUE,
- "# of elements per data block page must be greater than # of elements in index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "# of elements per data block page must be greater than # of elements in index block")
/* Compute the number of elements in data blocks for first actual super block */
sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs);
dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts);
if (dblk_page_nelmts < dblk_nelmts)
- H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in "
- "first data block from super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements per data block page bits must be > # of elements in "
+ "first data block from super block")
if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits)
- H5E_THROW(H5E_BADVALUE,
- "max. # of elements per data block page bits must be <= max. # of elements bits")
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements per data block page bits must be <= max. # of elements bits")
}
#endif /* NDEBUG */
/* Allocate space for the shared information */
if (NULL == (hdr = H5EA__hdr_alloc(f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array shared header")
/* Set the internal parameters for the array */
hdr->idx_blk_addr = HADDR_UNDEF;
@@ -389,49 +415,55 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Finish initializing extensible array header */
if (H5EA__hdr_init(hdr, ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, HADDR_UNDEF,
+ "initialization failed for extensible array header")
/* Allocate space for the header on disk */
if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array header")
/* Create 'top' proxy for extensible array entries */
if (hdr->swmr_write)
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create extensible array entry proxy")
/* Cache the new extensible array header */
if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array header to cache")
inserted = TRUE;
/* Add header as child of 'top' proxy */
if (hdr->top_proxy)
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
/* Set address of array header to return */
ret_value = hdr->addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (hdr) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(hdr) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array header from cache")
/* Release header's disk space */
if (H5F_addr_defined(hdr->addr) &&
H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free extensible array header")
/* Destroy header */
if (H5EA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array header")
} /* end if */
-END_FUNC(PKG) /* end H5EA__hdr_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_incr
@@ -445,7 +477,12 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_incr(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -453,14 +490,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if (hdr->rc == 0)
if (H5AC_pin_protected_entry(hdr) < 0)
- H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPIN, FAIL, "unable to pin extensible array header")
/* Increment reference count on shared header */
hdr->rc++;
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_incr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_incr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_decr
@@ -474,7 +511,12 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_decr(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -487,12 +529,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr))
if (hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
if (H5AC_unpin_entry(hdr) < 0)
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin extensible array header")
+ }
-END_FUNC(PKG) /* end H5EA__hdr_decr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_decr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_incr
@@ -506,7 +548,10 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -514,21 +559,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr))
/* Increment file reference count on shared header */
hdr->file_rc++;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__hdr_fuse_incr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_fuse_decr
*
* Purpose: Decrement file reference count on shared array header
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: The reference count of the header
+ * Failure: Can't fail
*
* Programmer: Quincey Koziol
* Aug 26 2008
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
+size_t
+H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)
+{
+ size_t ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -540,7 +592,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr))
/* Set return value */
ret_value = hdr->file_rc;
-END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_fuse_decr() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_modified
@@ -554,7 +607,12 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_modified(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -562,11 +620,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr))
/* Mark header as dirty in cache */
if (H5AC_mark_entry_dirty(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark extensible array header as dirty")
-END_FUNC(PKG) /* end H5EA__hdr_modified() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_modified() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_protect
@@ -580,12 +638,14 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL,
- H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags))
-
- /* Local variables */
+H5EA_hdr_t *
+H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags)
+{
H5EA_hdr_t * hdr; /* Extensible array header */
H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */
+ H5EA_hdr_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -601,27 +661,28 @@ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL,
/* Protect the header */
if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu",
- (unsigned long long)ea_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr)
hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
/* Create top proxy, if it doesn't exist */
if (hdr->swmr_write && NULL == hdr->top_proxy) {
/* Create 'top' proxy for extensible array entries */
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, NULL, "can't create extensible array entry proxy")
/* Add header as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
} /* end if */
/* Set return value */
ret_value = hdr;
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_protect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_unprotect
@@ -635,21 +696,24 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags))
+herr_t
+H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Unprotect the header */
if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu",
- (unsigned long long)hdr->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr)
-END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_delete
@@ -663,46 +727,48 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr))
-
- /* Local variables */
+herr_t
+H5EA__hdr_delete(H5EA_hdr_t *hdr)
+{
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
#ifndef NDEBUG
- {
- unsigned hdr_status = 0; /* Array header's status in the metadata cache */
+ unsigned hdr_status = 0; /* Array header's status in the metadata cache */
- /* Check the array header's status in the metadata cache */
- if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header")
+ /* Check the array header's status in the metadata cache */
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header")
- /* Sanity checks on array header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- } /* end block */
+ /* Sanity checks on array header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
#endif /* NDEBUG */
/* Check for index block */
if (H5F_addr_defined(hdr->idx_blk_addr)) {
/* Delete index block */
if (H5EA__iblock_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array index block")
} /* end if */
/* Set flags to finish deleting header on unprotect */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
+done:
/* Unprotect the header, deleting it if an error hasn't occurred */
if (H5EA__hdr_unprotect(hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header")
-END_FUNC(PKG) /* end H5EA__hdr_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__hdr_dest
@@ -716,7 +782,12 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
+herr_t
+H5EA__hdr_dest(H5EA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -725,7 +796,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Destroy the callback context */
if (hdr->cb_ctx) {
if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy extensible array client callback context")
} /* end if */
hdr->cb_ctx = NULL;
@@ -741,7 +813,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Check if this factory has been initialized */
if (hdr->elmt_fac.fac[u]) {
if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy extensible array header factory")
hdr->elmt_fac.fac[u] = NULL;
} /* end if */
} /* end for */
@@ -757,13 +830,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr))
/* Destroy the 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy extensible array 'top' proxy")
hdr->top_proxy = NULL;
} /* end if */
/* Free the shared info itself */
hdr = H5FL_FREE(H5EA_hdr_t, hdr);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__hdr_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__hdr_dest() */
diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c
index 1ef7980..5afb28a 100644
--- a/src/H5EAiblock.c
+++ b/src/H5EAiblock.c
@@ -91,21 +91,25 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t *hdr))
+H5EA_iblock_t *
+H5EA__iblock_alloc(H5EA_hdr_t *hdr)
+{
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ H5EA_iblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the index block */
if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array index block")
/* Share common array information */
if (H5EA__hdr_incr(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")
iblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -121,27 +125,30 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t
if (NULL ==
(iblock->elmts = H5FL_BLK_MALLOC(
idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size))))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block data element buffer")
/* Allocate buffer for data block addresses in index block */
if (iblock->ndblk_addrs > 0)
if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block data block addresses")
/* Allocate buffer for super block addresses in index block */
if (iblock->nsblk_addrs > 0)
if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for index block super block addresses")
/* Set the return value */
ret_value = iblock;
- CATCH
+done:
if (!ret_value)
if (iblock && H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
-
-END_FUNC(PKG) /* end H5EA__iblock_alloc() */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_create
@@ -155,13 +162,15 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed))
+haddr_t
+H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)
+{
+ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ haddr_t iblock_addr; /* Extensible array index block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
- haddr_t iblock_addr; /* Extensible array index block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -169,21 +178,24 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the index block */
if (NULL == (iblock = H5EA__iblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array index block")
/* Set size of index block on disk */
iblock->size = H5EA_IBLOCK_SIZE(iblock);
/* Allocate space for the index block on disk */
if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array index block")
iblock->addr = iblock_addr;
/* Clear any elements in index block to fill value */
if (hdr->cparam.idx_blk_elmts > 0) {
/* Call the class's 'fill' callback */
if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set extensible array index block elements to class's fill value")
} /* end if */
/* Reset any data block addresses in the index block */
@@ -204,13 +216,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Cache the new extensible array index block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF,
+ "can't add extensible array index block to cache")
inserted = TRUE;
/* Add index block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
iblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -229,25 +243,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of index block to return */
ret_value = iblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (iblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(iblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array index block from cache")
/* Release index block's disk space */
if (H5F_addr_defined(iblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release file space for extensible array index block")
/* Destroy index block */
if (H5EA__iblock_dest(iblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array index block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_protect
@@ -261,10 +279,13 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags))
+H5EA_iblock_t *
+H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)
+{
+ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ H5EA_iblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -275,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_
/* Protect the index block */
if (NULL ==
(iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags)))
- 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, NULL,
+ "unable to protect extensible array index block, address = %llu",
+ (unsigned long long)hdr->idx_blk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == iblock->top_proxy) {
/* Add index block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
iblock->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = iblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the index block, if it was protected */
if (iblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
- (unsigned long long)iblock->addr)
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
} /* end if */
-END_FUNC(PKG) /* end H5EA__iblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_unprotect
@@ -313,22 +338,25 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags))
+herr_t
+H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(iblock);
/* Unprotect the index block */
if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu",
- (unsigned long long)iblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array index block, address = %llu",
+ (unsigned long long)iblock->addr)
-END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_delete
@@ -342,10 +370,13 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr))
+herr_t
+H5EA__iblock_delete(H5EA_hdr_t *hdr)
+{
+ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA_iblock_t *iblock = NULL; /* Pointer to index block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -353,8 +384,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Protect index block */
if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET)))
- 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 for index block having data block pointers */
if (iblock->ndblk_addrs > 0) {
@@ -370,7 +402,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Delete data block */
if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u],
hdr->sblk_info[sblk_idx].dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL,
+ "unable to delete extensible array data block")
iblock->dblk_addrs[u] = HADDR_UNDEF;
} /* end if */
@@ -396,19 +429,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)
/* Delete super block */
if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) <
0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL,
+ "unable to delete extensible array super block")
iblock->sblk_addrs[u] = HADDR_UNDEF;
- } /* end if */
- } /* end for */
- } /* end if */
+ }
+ }
+ }
- CATCH
+done:
/* Finished deleting index block in metadata cache */
if (iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 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")
-END_FUNC(PKG) /* end H5EA__iblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__iblock_dest
@@ -422,7 +457,12 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *iblock))
+herr_t
+H5EA__iblock_dest(H5EA_iblock_t *iblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(iblock);
@@ -454,7 +494,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(iblock->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")
iblock->hdr = NULL;
} /* end if */
@@ -464,6 +505,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *ibl
/* Free the index block itself */
iblock = H5FL_FREE(H5EA_iblock_t, iblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__iblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__iblock_dest() */
diff --git a/src/H5EAint.c b/src/H5EAint.c
index 472cfb4..af7ff4c 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -79,8 +79,12 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Create a flush dependency between parent and child entry */
if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
-END_FUNC(PKG) /* end H5EA__create_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__create_flush_depend() */
/*-------------------------------------------------------------------------
* Function: H5EA__destroy_flush_depend
@@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Destroy a flush dependency between parent and child entry */
if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
-END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__destroy_flush_depend() */
diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c
index 8639217..30cb220 100644
--- a/src/H5EAsblock.c
+++ b/src/H5EAsblock.c
@@ -91,22 +91,25 @@ H5FL_BLK_DEFINE(page_init);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
- H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx))
+H5EA_sblock_t *
+H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)
+{
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ H5EA_sblock_t *ret_value = NULL;
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the index block */
if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for extensible array super block")
/* Share common array information */
if (H5EA__hdr_incr(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")
sblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -121,7 +124,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Allocate buffer for data block addresses in super block */
if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for super block data block addresses")
/* Check if # of elements in data blocks requires paging */
if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) {
@@ -141,7 +145,8 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Allocate buffer for all 'page init' bitmasks in super block */
if (NULL ==
(sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for super block page init bitmask")
/* Compute data block page size */
sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM;
@@ -150,12 +155,13 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Set the return value */
ret_value = sblock;
- CATCH
+done:
if (!ret_value)
if (sblock && H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block")
-END_FUNC(PKG) /* end H5EA__sblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_create
@@ -169,15 +175,16 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed,
- unsigned sblk_idx))
+haddr_t
+H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed, unsigned sblk_idx)
+{
+ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ haddr_t sblock_addr; /* Extensible array super block address */
+ haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
- haddr_t sblock_addr; /* Extensible array super block address */
- haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -185,7 +192,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the super block */
if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for extensible array super block")
/* Set size of super block on disk */
sblock->size = H5EA_SBLOCK_SIZE(sblock);
@@ -195,7 +203,8 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate space for the super block on disk */
if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for extensible array super block")
sblock->addr = sblock_addr;
/* Reset data block addresses to "undefined" address value */
@@ -203,13 +212,15 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Cache the new extensible array super block */
if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF,
+ "can't add extensible array super block to cache")
inserted = TRUE;
/* Add super block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add extensible array entry as child of array proxy")
sblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -223,25 +234,29 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of super block to return */
ret_value = sblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (sblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(sblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove extensible array super block from cache")
/* Release super block's disk space */
if (H5F_addr_defined(sblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to release extensible array super block")
/* Destroy super block */
if (H5EA__sblock_dest(sblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block")
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF,
+ "unable to destroy extensible array super block")
} /* end if */
-END_FUNC(PKG) /* end H5EA__sblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_create() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_protect
@@ -255,13 +270,15 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
- H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx,
- unsigned flags))
-
- /* Local variables */
+H5EA_sblock_t *
+H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx,
+ unsigned flags)
+{
H5EA_sblock_t * sblock = NULL; /* Pointer to super block */
H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */
+ H5EA_sblock_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -279,31 +296,35 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL,
/* Protect the super block */
if (NULL ==
(sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)sblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == sblock->top_proxy) {
/* Add super block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL,
+ "unable to add extensible array entry as child of array proxy")
sblock->top_proxy = hdr->top_proxy;
- } /* end if */
+ }
/* Set return value */
ret_value = sblock;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the super block, if it was protected */
if (sblock &&
H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
- (unsigned long long)sblock->addr)
- } /* end if */
+ HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
+ }
-END_FUNC(PKG) /* end H5EA__sblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_unprotect
@@ -317,22 +338,25 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags))
+herr_t
+H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(sblock);
/* Unprotect the super block */
if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu",
- (unsigned long long)sblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect extensible array super block, address = %llu",
+ (unsigned long long)sblock->addr)
-END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_delete
@@ -346,12 +370,14 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx))
-
- /* Local variables */
+herr_t
+H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx)
+{
H5EA_sblock_t *sblock = NULL; /* Pointer to super block */
size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -359,8 +385,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Protect super block */
if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu",
- (unsigned long long)sblk_addr)
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect extensible array super block, address = %llu",
+ (unsigned long long)sblk_addr)
/* Iterate over data blocks */
for (u = 0; u < sblock->ndblks; u++) {
@@ -368,18 +395,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (H5F_addr_defined(sblock->dblk_addrs[u])) {
/* Delete data block */
if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array data block")
sblock->dblk_addrs[u] = HADDR_UNDEF;
} /* end if */
} /* end for */
- CATCH
+done:
/* Finished deleting super block in metadata cache */
if (sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 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")
-END_FUNC(PKG) /* end H5EA__sblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5EA__sblock_dest
@@ -393,7 +421,12 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sblock))
+herr_t
+H5EA__sblock_dest(H5EA_sblock_t *sblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(sblock);
@@ -413,7 +446,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl
/* Decrement reference count on shared info */
if (H5EA__hdr_decr(sblock->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")
sblock->hdr = NULL;
} /* end if */
@@ -423,6 +457,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sbl
/* Free the super block itself */
sblock = H5FL_FREE(H5EA_sblock_t, sblock);
- CATCH
-
-END_FUNC(PKG) /* end H5EA__sblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__sblock_dest() */
diff --git a/src/H5EAstat.c b/src/H5EAstat.c
index 47b9a86..5705cb8 100644
--- a/src/H5EAstat.c
+++ b/src/H5EAstat.c
@@ -80,17 +80,17 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats))
+herr_t
+H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /* Local variables */
-
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(stats);
/* Copy extensible array statistics */
H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats));
-END_FUNC(PRIV) /* end H5EA_get_stats() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA_get_stats() */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index dd669fc..7924eaa 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -119,17 +119,19 @@ H5FL_DEFINE_STATIC(H5EA__ctx_cb_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata))
+static void *
+H5EA__test_crt_context(void *_udata)
+{
+ H5EA__test_ctx_t *ctx; /* Context for callbacks */
+ H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */
+ void * ret_value = NULL;
- /* Local variables */
- H5EA__test_ctx_t *ctx; /* Context for callbacks */
- H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */
-
- /* Sanity checks */
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Initialize the context */
ctx->bogus = H5EA__TEST_BOGUS_VAL;
@@ -138,9 +140,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata)
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_crt_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_crt_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_dst_context
@@ -155,18 +157,21 @@ END_FUNC(STATIC) /* end H5EA__test_crt_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5EA__test_dst_context(void *_ctx)
+{
H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus);
/* Release context structure */
ctx = H5FL_FREE(H5EA__test_ctx_t, ctx);
-END_FUNC(STATIC) /* end H5EA__test_dst_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_fill
@@ -181,18 +186,21 @@ END_FUNC(STATIC) /* end H5EA__test_dst_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_fill(void *nat_blk, size_t nelmts))
-
- /* Local variables */
+static herr_t
+H5EA__test_fill(void *nat_blk, size_t nelmts)
+{
uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(nat_blk);
HDassert(nelmts);
H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts);
-END_FUNC(STATIC) /* end H5EA__test_fill() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_fill() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_encode
@@ -207,12 +215,14 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx))
+static herr_t
+H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)
+{
+ H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
- const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(raw);
@@ -223,13 +233,12 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Check for callback action */
if (ctx->cb) {
if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0)
- H5E_THROW(H5E_BADVALUE, "extensible array testing callback action failed")
- } /* end if */
+ HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "extensible array testing callback action failed")
+ }
/* Encode native elements into raw elements */
while (nelmts) {
- /* Encode element */
- /* (advances 'raw' pointer) */
+ /* Encode element - advances 'raw' pointer */
UINT64ENCODE(raw, *elmt);
/* Advance native element pointer */
@@ -237,11 +246,11 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Decrement # of elements to encode */
nelmts--;
- } /* end while */
+ }
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_encode() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_encode() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_decode
@@ -256,16 +265,17 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDEBUG_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */
#endif /* NDEBUG */
uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(raw);
HDassert(elmt);
@@ -274,8 +284,7 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Decode raw elements into native elements */
while (nelmts) {
- /* Decode element */
- /* (advances 'raw' pointer) */
+ /* Decode element - advances 'raw' pointer */
UINT64DECODE(raw, *elmt);
/* Advance native element pointer */
@@ -283,9 +292,10 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Decrement # of elements to decode */
nelmts--;
- } /* end while */
+ }
-END_FUNC(STATIC) /* end H5EA__test_decode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_decode() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_debug
@@ -300,12 +310,13 @@ END_FUNC(STATIC) /* end H5EA__test_decode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt))
-
- /* Local variables */
+static herr_t
+H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
+{
char temp_str[128]; /* Temporary string, for formatting */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(stream);
HDassert(elmt);
@@ -315,7 +326,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
-END_FUNC(STATIC) /* end H5EA__test_debug() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_debug() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_crt_dbg_context
@@ -329,22 +341,25 @@ END_FUNC(STATIC) /* end H5EA__test_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr))
-
- /* Local variables */
+static void *
+H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)
+{
H5EA__ctx_cb_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+ HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL,
+ "can't allocate extensible array client callback context")
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__test_dst_dbg_context
@@ -358,17 +373,20 @@ END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_dbg_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5EA__test_dst_dbg_context(void *_ctx)
+{
H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
HDassert(_ctx);
/* Release context structure */
ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx);
-END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__test_dst_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5EA__get_cparam_test
@@ -383,7 +401,10 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam))
+herr_t
+H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(ea);
@@ -397,7 +418,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *e
cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts;
cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits;
-END_FUNC(PKG) /* end H5EA__get_cparam_test() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5EA__get_cparam_test() */
/*-------------------------------------------------------------------------
* Function: H5EA__cmp_cparam_test
@@ -412,39 +434,48 @@ END_FUNC(PKG) /* end H5EA__get_cparam_test() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
- H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2))
+int
+H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)
+{
+ int ret_value = 0;
- /* Check arguments. */
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Check arguments */
HDassert(cparam1);
HDassert(cparam2);
/* Compare creation parameters for array */
if (cparam1->raw_elmt_size < cparam2->raw_elmt_size)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts)
- H5_LEAVE(1)
+ HGOTO_DONE(1)
+
if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits)
- H5_LEAVE(-1)
+ HGOTO_DONE(-1)
else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits)
- H5_LEAVE(1)
-
- CATCH
+ HGOTO_DONE(1)
-END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5EA__cmp_cparam_test() */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 4cd8b70..cd567aa 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -180,53 +180,6 @@ extern int H5E_mpi_error_str_len;
}
#endif /* H5_HAVE_PARALLEL */
-/******************************************************************************/
-/* Revisions to Error Macros, to go with Revisions to FUNC_ENTER/LEAVE Macros */
-/******************************************************************************/
-
-/*
- * H5E_PRINTF macro, used to facilitate error reporting between a BEGIN_FUNC()
- * and an END_FUNC() within a function body. The arguments are the minor
- * error number, a description of the error (as a printf-like format string),
- * and an optional set of arguments for the printf format arguments.
- */
-#define H5E_PRINTF(...) \
- H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, H5_MY_PKG_ERR, __VA_ARGS__)
-
-/*
- * H5_LEAVE macro, used to facilitate control flow between a
- * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is
- * the return value.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
- */
-#define H5_LEAVE(v) \
- { \
- ret_value = v; \
- if (!past_catch) \
- goto catch_except; \
- }
-
-/*
- * H5E_THROW macro, used to facilitate error reporting between a
- * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are
- * the minor error number, and an error string.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
- */
-#define H5E_THROW(...) \
- { \
- H5E_PRINTF(__VA_ARGS__); \
- H5_LEAVE(fail_value) \
- }
-
-/* Macro for "catching" flow of control when an error occurs. Note that the
- * H5_LEAVE macro won't jump back here once it's past this point.
- */
-#define CATCH \
-catch_except:; \
- past_catch = TRUE;
-
/* Library-private functions defined in H5E package */
H5_DLL herr_t H5E_init(void);
H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id,
diff --git a/src/H5FA.c b/src/H5FA.c
index 05b0bd8..ad69ee2 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -105,39 +105,40 @@ H5FL_BLK_DEFINE(fa_native_elmt);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL,
- H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata))
+static H5FA_t *
+H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata)
+{
+ H5FA_t * fa = NULL; /* Pointer to new fixed array */
+ H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ H5FA_t * ret_value = NULL;
- /* Local variables */
- H5FA_t * fa = NULL; /* Pointer to new fixed array */
- H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ FUNC_ENTER_STATIC
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Allocate fixed array wrapper */
if (NULL == (fa = H5FL_CALLOC(H5FA_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array info")
/* Lock the array header into memory */
if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to load fixed array header")
/* Check for pending array deletion */
if (from_open && hdr->pending_delete)
- H5E_THROW(H5E_CANTOPENOBJ, "can't open fixed array pending deletion")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTOPENOBJ, NULL, "can't open fixed array pending deletion")
/* Point fixed array wrapper at header and bump it's ref count */
fa->hdr = hdr;
if (H5FA__hdr_incr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
/* Increment # of files using this array header */
if (H5FA__hdr_fuse_incr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL,
+ "can't increment file reference count on shared array header")
/* Set file pointer for this array open context */
fa->f = f;
@@ -145,15 +146,15 @@ BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL,
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to release fixed array header")
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(STATIC) /* end H5FA__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__new() */
/*-------------------------------------------------------------------------
* Function: H5FA_create
@@ -168,16 +169,16 @@ END_FUNC(STATIC) /* end H5FA__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL,
- H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
-
- /* Local variables */
+H5FA_t *
+H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)
+{
H5FA_t *fa = NULL; /* Pointer to new fixed array */
haddr_t fa_addr; /* Fixed array header address */
+ H5FA_t *ret_value = NULL;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(NULL)
+
+ /* Check arguments */
HDassert(f);
HDassert(cparam);
@@ -186,22 +187,23 @@ BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL,
/* Create fixed array header */
if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "can't create fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "can't create fixed array header")
/* Allocate and initialize new fixed array wrapper */
if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for fixed array wrapper")
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(PRIV) /* end H5FA_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_create() */
/*-------------------------------------------------------------------------
* Function: H5FA_open
@@ -216,31 +218,33 @@ END_FUNC(PRIV) /* end H5FA_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata))
+H5FA_t *
+H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata)
+{
+ H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */
+ H5FA_t *ret_value = NULL;
- /* Local variables */
- H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */
+ FUNC_ENTER_NOAPI(NULL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Allocate and initialize new fixed array wrapper */
if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata)))
- H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL,
+ "allocation and/or initialization failed for fixed array wrapper")
/* Set the return value */
ret_value = fa;
- CATCH
-
+done:
if (!ret_value)
if (fa && H5FA_close(fa) < 0)
- H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array")
+ HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array")
-END_FUNC(PRIV) /* end H5FA_open() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_open() */
/*-------------------------------------------------------------------------
* Function: H5FA_get_nelmts
@@ -254,20 +258,20 @@ END_FUNC(PRIV) /* end H5FA_open() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts))
-
- /* Local variables */
+herr_t
+H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(nelmts);
/* Retrieve the current number of elements in the fixed array */
*nelmts = fa->hdr->stats.nelmts;
-END_FUNC(PRIV) /* end H5FA_get_nelmts() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_nelmts() */
/*-------------------------------------------------------------------------
* Function: H5FA_get_addr
@@ -281,13 +285,12 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, haddr_t *addr))
-
- /* Local variables */
+herr_t
+H5FA_get_addr(const H5FA_t *fa, haddr_t *addr)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
HDassert(addr);
@@ -295,7 +298,8 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, hadd
/* Retrieve the address of the fixed array's header */
*addr = fa->hdr->addr;
-END_FUNC(PRIV) /* end H5FA_get_addr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_addr() */
/*-------------------------------------------------------------------------
* Function: H5FA_set
@@ -309,9 +313,9 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt))
-
- /* Local variables */
+herr_t
+H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)
+{
H5FA_hdr_t * hdr = fa->hdr; /* Header for fixed array */
H5FA_dblock_t * dblock = NULL; /* Pointer to fixed array Data block */
H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to fixed array Data block page */
@@ -319,10 +323,11 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
unsigned dblk_page_cache_flags =
H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */
hbool_t hdr_dirty = FALSE; /* Whether header information changed */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
@@ -334,15 +339,16 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
/* Create the data block */
hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty);
if (!H5F_addr_defined(hdr->dblk_addr))
- H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create fixed array data block")
+ }
HDassert(idx < hdr->cparam.nelmts);
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)hdr->dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu",
+ (unsigned long long)hdr->dblk_addr)
/* Check for paging data block */
if (!dblock->npages) {
@@ -375,7 +381,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) {
/* Create the data block page */
if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0)
- H5E_THROW(H5E_CANTCREATE, "unable to create data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page")
/* Mark data block page as initialized in data block */
H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE);
@@ -385,8 +391,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
/* Protect the data block page */
if (NULL ==
(dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Set the element in the data block page */
H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt,
@@ -394,19 +401,20 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t
dblk_page_cache_flags |= H5AC__DIRTIED_FLAG;
} /* end else */
- CATCH
+done:
/* Check for header modified */
if (hdr_dirty)
if (H5FA__hdr_modified(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as modified")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as modified")
/* Release resources */
if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page")
-END_FUNC(PRIV) /* end H5FA_set() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_set() */
/*-------------------------------------------------------------------------
* Function: H5FA_get
@@ -420,16 +428,17 @@ END_FUNC(PRIV) /* end H5FA_set() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt))
-
- /* Local variables */
+herr_t
+H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)
+{
H5FA_hdr_t * hdr = fa->hdr; /* Header for FA */
H5FA_dblock_t * dblock = NULL; /* Pointer to data block for FA */
H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
HDassert(fa->hdr);
@@ -440,14 +449,15 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
if (!H5F_addr_defined(hdr->dblk_addr)) {
/* 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_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
} /* end if */
else {
/* Get the data block */
HDassert(H5F_addr_defined(hdr->dblk_addr));
if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)hdr->dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu",
+ (unsigned long long)hdr->dblk_addr)
/* Check for paged data block */
if (!dblock->npages)
@@ -464,10 +474,10 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) {
/* 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_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value")
/* We've retrieved the value, leave now */
- H5_LEAVE(SUCCEED)
+ HGOTO_DONE(SUCCEED)
} /* end if */
else { /* get the page */
size_t dblk_page_nelmts; /* # of elements in a data block page */
@@ -490,9 +500,9 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
/* Protect the data block page */
if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts,
H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Retrieve element from data block */
H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx),
@@ -501,13 +511,14 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t
} /* end else */
} /* end else */
- CATCH
+done:
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page")
-END_FUNC(PRIV) /* end H5FA_get() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_get() */
/*-------------------------------------------------------------------------
* Function: H5FA_close
@@ -521,18 +532,19 @@ END_FUNC(PRIV) /* end H5FA_get() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
-
- /* Local variables */
+herr_t
+H5FA_close(H5FA_t *fa)
+{
hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */
haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */
+ herr_t ret_value = SUCCEED;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
HDassert(fa);
- /* Close the header, if it was set */
+ /* Close the header if it was set */
if (fa->hdr) {
/* Decrement file reference & check if this is the last open fixed array using the shared array header
*/
@@ -562,7 +574,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
/* Check the header's status in the metadata cache */
if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL,
+ "unable to check metadata cache status for fixed array header")
/* Sanity checks on header */
HDassert(hdr_status & H5AC_ES__IN_CACHE);
@@ -574,7 +587,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
/* 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 = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTLOAD, FAIL, "unable to load fixed array header")
/* Set the shared array header's file context for this operation */
hdr->f = fa->f;
@@ -584,11 +597,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
* immediately -QAK)
*/
if (H5FA__hdr_decr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
/* Delete array, starting with header (unprotects header) */
if (H5FA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array")
} /* end if */
else {
/* Decrement the reference count on the array header */
@@ -596,16 +610,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa))
* immediately -QAK)
*/
if (H5FA__hdr_decr(fa->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
} /* end else */
} /* end if */
/* Release the fixed array wrapper */
fa = H5FL_FREE(H5FA_t, fa);
- CATCH
-
-END_FUNC(PRIV) /* end H5FA_close() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_close() */
/*-------------------------------------------------------------------------
* Function: H5FA_delete
@@ -619,21 +634,22 @@ END_FUNC(PRIV) /* end H5FA_close() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata))
+herr_t
+H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata)
+{
+ H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* The fixed array header information */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(fa_addr));
/* Lock the array header into memory */
if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu",
- (unsigned long long)fa_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array header, address = %llu",
+ (unsigned long long)fa_addr)
/* Check for files using shared array header */
if (hdr->file_rc)
@@ -644,17 +660,17 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_ad
/* Delete array now, starting with header (unprotects header) */
if (H5FA__hdr_delete(hdr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array")
hdr = NULL;
- } /* end if */
-
- CATCH
+ }
- /* Unprotect the header, if an error occurred */
+done:
+ /* Unprotect the header if an error occurred */
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PRIV) /* end H5FA_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA_iterate
@@ -671,44 +687,44 @@ END_FUNC(PRIV) /* end H5FA_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR,
- H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
-
- /* Local variables */
+int
+H5FA_iterate(H5FA_t *fa, H5FA_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;
- /*
- * Check arguments.
- */
+ FUNC_ENTER_NOAPI(H5_ITER_ERROR)
+
+ /* Check arguments */
HDassert(fa);
HDassert(op);
HDassert(udata);
/* Allocate space for a native array element */
if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, H5_ITER_ERROR,
+ "memory allocation failed for fixed array element")
/* Iterate over all elements in array */
- for (u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) {
+ for (u = 0; u < fa->hdr->stats.nelmts && ret_value == H5_ITER_CONT; u++) {
/* Get array element */
if (H5FA_get(fa, u, elmt) < 0)
- H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
+ HGOTO_ERROR(H5E_FARRAY, 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
+ /* Invoke callback */
+ if ((ret_value = (*op)(u, elmt, udata)) < 0) {
+ HERROR(H5E_FARRAY, H5E_BADITER, "iteration callback error");
+ break;
+ }
+ }
+done:
if (elmt)
elmt = H5FL_BLK_FREE(fa_native_elmt, elmt);
-END_FUNC(PRIV) /* end H5FA_iterate() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_iterate() */
/*-------------------------------------------------------------------------
* Function: H5FA_depend
@@ -723,14 +739,15 @@ END_FUNC(PRIV) /* end H5FA_iterate() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent))
+herr_t
+H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent)
+{
+ H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */
+ FUNC_ENTER_NOAPI(FAIL)
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(hdr);
HDassert(parent);
@@ -749,13 +766,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_
/* Add the fixed 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 fixed array as child of proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "unable to add fixed array as child of proxy")
hdr->parent = parent;
- } /* end if */
-
- CATCH
+ }
-END_FUNC(PRIV) /* end H5FA_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA_depend() */
/*-------------------------------------------------------------------------
* Function: H5FA_patch_file
@@ -769,17 +786,17 @@ END_FUNC(PRIV) /* end H5FA_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_patch_file(H5FA_t *fa, H5F_t *f))
+herr_t
+H5FA_patch_file(H5FA_t *fa, H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOERR
- /* Local variables */
-
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(f);
if (fa->f != f || fa->hdr->f != f)
fa->f = fa->hdr->f = f;
-END_FUNC(PRIV) /* end H5FA_patch_file() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_patch_file() */
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 1b127c7..367b4b0 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -167,12 +167,13 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; /* User data for callback */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->f);
@@ -181,7 +182,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f);
-END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_verify_chksum
@@ -196,13 +198,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -213,7 +217,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_deserialize
@@ -228,16 +233,18 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_cls_id_t id; /* ID of fixed array class, as found in file */
H5FA_hdr_t * hdr = NULL; /* Fixed array info */
H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata;
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(udata);
@@ -246,24 +253,24 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate space for the fixed array data structure */
if (NULL == (hdr = H5FA__hdr_alloc(udata->f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array shared header")
/* Set the fixed array header's address */
hdr->addr = udata->addr;
/* Magic number */
if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5FA_HDR_VERSION)
- H5E_THROW(H5E_VERSION, "wrong fixed array header version")
+ HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array header version")
/* Fixed array class */
id = (H5FA_cls_id_t)*image++;
if (id >= H5FA_NUM_CLS_ID)
- H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class")
hdr->cparam.cls = H5FA_client_class_g[id];
/* General array creation/configuration information */
@@ -311,20 +318,20 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Finish initializing fixed array header */
if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "initialization failed for fixed array header")
HDassert(hdr->size == len);
/* Set return value */
ret_value = hdr;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (hdr && H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header")
-END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_image_len
@@ -338,12 +345,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(hdr);
HDassert(image_len);
@@ -351,7 +359,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = hdr->size;
-END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_serialize
@@ -365,15 +374,16 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the fixed array header */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
- /* check arguments */
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check arguments */
HDassert(f);
HDassert(image);
HDassert(hdr);
@@ -410,7 +420,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
-END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_hdr_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_notify
@@ -424,11 +435,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(hdr);
@@ -460,16 +473,16 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Destroy flush dependency on object header proxy */
if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent,
(void *)hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTUNDEPEND,
- "unable to destroy flush dependency between fixed array and proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between fixed array and proxy")
hdr->parent = NULL;
} /* end if */
/* Detach from 'top' proxy for fixed array */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0)
- H5E_THROW(
- H5E_CANTUNDEPEND,
+ HGOTO_ERROR(
+ H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
"unable to destroy flush dependency between header and fixed array 'top' proxy")
/* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */
} /* end if */
@@ -477,7 +490,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
@@ -486,9 +499,10 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
else
HDassert(NULL == hdr->parent);
- CATCH
+done:
-END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_hdr_free_icr
@@ -503,18 +517,23 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_hdr_free_icr(void *thing))
+static herr_t
+H5FA__cache_hdr_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the extensible array header */
if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array header")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header")
-END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_hdr_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_get_initial_load_size
@@ -528,14 +547,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data */
H5FA_dblock_t dblock; /* Fake data block for computing size */
size_t dblk_page_nelmts; /* # of elements per data block page */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -564,7 +584,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = (size_t)H5FA_DBLOCK_PREFIX_SIZE(&dblock);
-END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_verify_chksum
@@ -579,13 +600,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -596,7 +619,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_deserialize
@@ -611,16 +635,18 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata,
+ hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_dblock_t * dblock = NULL; /* Data block info */
H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data for loading data block */
const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
haddr_t arr_addr; /* Address of array header in the file */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
@@ -628,7 +654,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the fixed array data block */
if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block")
HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) ||
(len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock)));
@@ -638,27 +664,27 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Magic number */
if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
- H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array data block signature")
image += H5_SIZEOF_MAGIC;
/* Version */
if (*image++ != H5FA_DBLOCK_VERSION)
- H5E_THROW(H5E_VERSION, "wrong fixed array data block version")
+ HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array data block version")
/* Fixed array type */
if (*image++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class")
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(udata->hdr->f, &image, &arr_addr);
if (H5F_addr_ne(arr_addr, udata->hdr->addr))
- H5E_THROW(H5E_BADVALUE, "wrong fixed array header address")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header address")
/* Page initialization flags */
if (dblock->npages > 0) {
H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
- } /* end if */
+ }
/* Only decode elements if the data block is not paged */
if (!dblock->npages) {
@@ -666,9 +692,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts,
udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements")
image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size);
- } /* end if */
+ }
/* Sanity check */
/* (allow for checksum not decoded yet) */
@@ -688,14 +714,14 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblock;
- CATCH
-
+done:
/* Release resources */
if (!ret_value)
if (dblock && H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block")
-END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_image_len
@@ -709,12 +735,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(image_len);
@@ -725,7 +752,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
else
*image_len = H5FA_DBLOCK_PREFIX_SIZE(dblock);
-END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_serialize
@@ -739,14 +767,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
- void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)
+{
H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(f);
@@ -773,7 +802,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Store the 'page init' bitmasks */
H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
- } /* end if */
+ }
/* Only encode elements if the data block is not paged */
if (!dblock->npages) {
@@ -783,9 +812,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t);
if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts,
dblock->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements")
image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size);
- } /* end if */
+ }
/* Compute metadata checksum */
metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0);
@@ -796,9 +825,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_notify
@@ -812,11 +841,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing))
+static herr_t
+H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)
+{
+ H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing;
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing;
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblock);
@@ -829,8 +860,8 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_AFTER_LOAD:
/* Create flush dependency on parent */
if (H5FA__create_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(
- H5E_CANTDEPEND,
+ HGOTO_ERROR(
+ H5E_FARRAY, H5E_CANTDEPEND, FAIL,
"unable to create flush dependency between data block and header, address = %llu",
(unsigned long long)dblock->addr)
break;
@@ -842,35 +873,35 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
case H5AC_NOTIFY_ACTION_CHILD_CLEANED:
case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED:
case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED:
- /* do nothing */
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
/* Detach from 'top' proxy for fixed array */
if (dblock->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block "
- "and fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block "
+ "and fixed array 'top' proxy")
dblock->top_proxy = NULL;
- } /* end if */
+ }
break;
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
-#else /* NDEBUG */
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
+#else
HDassert(0 && "Unknown action?!?");
-#endif /* NDEBUG */
+#endif
} /* end switch */
} /* end if */
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_free_icr
@@ -885,20 +916,24 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_free_icr(void *_thing))
+static herr_t
+H5FA__cache_dblock_free_icr(void *_thing)
+{
+ H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
- H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(dblock);
/* Release the fixed array data block */
if (H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array data block")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block")
-END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblock_free_icr() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblock_fsf_size
@@ -929,11 +964,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
-
+static herr_t
+H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)
+{
const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblock);
HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
@@ -942,7 +979,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
*fsf_size = dblock->size;
-END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblock_fsf_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_get_initial_load_size
@@ -956,12 +994,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)
+{
H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(udata);
HDassert(udata->hdr);
@@ -971,7 +1010,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts);
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblk_page_get_initial_load_size() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_verify_chksum
@@ -986,13 +1026,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
- H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata))
-
- /* Local variables */
+static htri_t
+H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)
+{
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
+ htri_t ret_value = TRUE;
+
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments */
HDassert(image);
@@ -1003,7 +1045,8 @@ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -,
if (stored_chksum != computed_chksum)
ret_value = FALSE;
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_verify_chksum() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_deserialize
@@ -1018,18 +1061,19 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata,
- hbool_t H5_ATTR_UNUSED *dirty))
-
- /* Local variables */
+static void *
+H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)
+{
H5FA_dblk_page_t * dblk_page = NULL; /* Data block page info */
H5FA_dblk_page_cache_ud_t *udata =
(H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t stored_chksum; /* Stored metadata checksum value */
+ void * ret_value = NULL;
/* Sanity check */
+ FUNC_ENTER_STATIC
+
HDassert(udata);
HDassert(udata->hdr);
HDassert(udata->nelmts > 0);
@@ -1037,7 +1081,8 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Allocate the fixed array data block page */
if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for fixed array data block page")
/* Set the fixed array data block's information */
dblk_page->addr = udata->dblk_page_addr;
@@ -1047,7 +1092,7 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Decode elements in data block page */
/* Convert from raw elements on disk into native elements in memory */
if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements")
image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size);
/* Sanity check */
@@ -1068,14 +1113,15 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Release resources */
if (!ret_value)
if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page")
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_deserialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_image_len
@@ -1089,12 +1135,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)
+{
const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */
+ FUNC_ENTER_STATIC_NOERR
+
/* Check arguments */
HDassert(dblk_page);
HDassert(image_len);
@@ -1102,7 +1149,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
/* Set the image length size */
*image_len = dblk_page->size;
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__cache_dblk_page_image_len() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_serialize
@@ -1116,14 +1164,16 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image,
- size_t H5_ATTR_UNUSED len, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
+ void *_thing)
+{
H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object to serialize */
uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -1138,7 +1188,7 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Convert from native elements in memory into raw elements on disk */
if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts,
dblk_page->hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements")
image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size);
/* Compute metadata checksum */
@@ -1150,9 +1200,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) == len);
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_serialize() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_notify
@@ -1166,11 +1216,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
- H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing))
-
- /* Local variables */
+static herr_t
+H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)
+{
H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(dblk_page);
@@ -1187,8 +1239,9 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
/* Detach from 'top' proxy for fixed array */
if (dblk_page->top_proxy) {
if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page "
- "and fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL,
+ "unable to destroy flush dependency between data block page "
+ "and fixed array 'top' proxy")
dblk_page->top_proxy = NULL;
} /* end if */
break;
@@ -1204,15 +1257,15 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL,
default:
#ifdef NDEBUG
- H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
#else /* NDEBUG */
HDassert(0 && "Unknown action?!?");
#endif /* NDEBUG */
} /* end switch */
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_notify() */
/*-------------------------------------------------------------------------
* Function: H5FA__cache_dblk_page_free_icr
@@ -1227,15 +1280,20 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_free_icr(void *thing))
+static herr_t
+H5FA__cache_dblk_page_free_icr(void *thing)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(thing);
/* Release the fixed array data block page */
if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0)
- H5E_THROW(H5E_CANTFREE, "can't free fixed array data block page")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block page")
-END_FUNC(STATIC) /* end H5FA__cache_dblk_page_free_icr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__cache_dblk_page_free_icr() */
diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c
index 8c2c9a8..a69c078 100644
--- a/src/H5FAdbg.c
+++ b/src/H5FAdbg.c
@@ -79,13 +79,16 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5FA_class_t *cls, haddr_t obj_addr))
-
+herr_t
+H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls,
+ haddr_t obj_addr)
+{
/* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */
- void * dbg_ctx = NULL; /* Fixed array debugging context */
+ H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */
+ void * dbg_ctx = NULL; /* Fixed array debugging context */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -100,11 +103,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the fixed array header */
if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header")
/* Print opening message */
HDfprintf(stream, "%*sFixed Array Header...\n", indent, "");
@@ -126,13 +129,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth,
"Fixed Array Data Block Address:", hdr->dblk_addr);
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context")
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__hdr_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_debug() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_debug
@@ -146,15 +150,18 @@ END_FUNC(PKG) /* end H5FA__hdr_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
- const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
-
+herr_t
+H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls,
+ haddr_t hdr_addr, haddr_t obj_addr)
+{
/* Local variables */
- H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */
- H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
- void * dbg_ctx = NULL; /* Fixed array context */
- size_t u; /* Local index variable */
+ H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */
+ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
+ void * dbg_ctx = NULL; /* Fixed array context */
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -170,16 +177,16 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (cls->crt_dbg_ctx)
/* Create debugging context */
if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr)))
- H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context")
/* Load the fixed array header */
if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header")
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)addr)
/* Print opening message */
HDfprintf(stream, "%*sFixed Array data Block...\n", indent, "");
@@ -222,9 +229,9 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts,
H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT,
- "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx);
for (u = 0; u < dblk_page_nelmts; u++) {
@@ -232,10 +239,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblk_page->elmts) +
(hdr->cparam.cls->nat_elmt_size * u)) < 0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to release fixed array data block page")
/* Advance to next page address */
dblk_page_addr += dblock->dblk_page_size;
@@ -250,16 +258,17 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u,
((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) <
0)
- H5E_THROW(H5E_CANTGET, "can't get element for debugging")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging")
} /* end for */
} /* end else */
- CATCH
+done:
if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context")
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__dblock_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_debug() */
diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c
index 0f5ee29..1dca0fb 100644
--- a/src/H5FAdblkpage.c
+++ b/src/H5FAdblkpage.c
@@ -84,21 +84,25 @@ H5FL_BLK_DEFINE(page_elmts);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts))
-
- /* Local variables */
+H5FA_dblk_page_t *
+H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)
+{
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
+ H5FA_dblk_page_t *ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
/* Allocate memory for the data block */
if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for fixed array data block page")
/* Share common array information */
if (H5FA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblk_page->hdr = hdr;
/* Set non-zero internal fields */
@@ -106,37 +110,41 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_
/* Allocate buffer for elements in data block page */
if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block page element buffer")
/* Set the return value */
ret_value = dblk_page;
- CATCH
+done:
if (!ret_value)
if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page")
-END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_create
*
* Purpose: Creates a new fixed array data block page in the file
*
- * Return: Valid file address on success/HADDR_UNDEF on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts))
-
- /* Local variables */
+herr_t
+H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts)
+{
H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */
hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr);
@@ -147,7 +155,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Allocate the data block page */
if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, FAIL,
+ "memory allocation failed for fixed array data block page")
/* Set info about data block page on disk */
dblk_page->addr = addr;
@@ -158,34 +167,38 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Clear any elements in data block page to fill value */
if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL,
+ "can't set fixed array data block page elements to class's fill value")
/* Cache the new fixed array data block page */
if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, FAIL, "can't add fixed array data block page to cache")
inserted = TRUE;
/* Add data block page as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL,
+ "unable to add fixed array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
- CATCH
+done:
if (ret_value < 0)
if (dblk_page) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblk_page) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block page from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, FAIL,
+ "unable to remove fixed array data block page from cache")
/* Destroy data block page */
if (H5FA__dblk_page_dest(dblk_page) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "unable to destroy fixed array data block page")
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblk_page_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_protect
@@ -200,13 +213,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL,
- H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts,
- unsigned flags))
-
- /* Local variables */
+H5FA_dblk_page_t *
+H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags)
+{
H5FA_dblk_page_t * dblk_page = NULL; /* Fixed array data block page */
H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */
+ H5FA_dblk_page_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
@@ -227,32 +241,36 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL,
/* Protect the data block page */
if (NULL == (dblk_page = (H5FA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr,
&udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblk_page->top_proxy) {
/* Add data block page as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
dblk_page->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblk_page;
- CATCH
+done:
/* Clean up on error */
if (!ret_value) {
/* Release the data block page, if it was protected */
if (dblk_page &&
H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblk_page_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_unprotect
@@ -267,10 +285,12 @@ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags))
+herr_t
+H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
-/* Local variables */
+ FUNC_ENTER_PACKAGE
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
@@ -281,12 +301,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Unprotect the data block page */
if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu",
- (unsigned long long)dblk_page->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array data block page, address = %llu",
+ (unsigned long long)dblk_page->addr)
-END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblk_page_dest
@@ -300,7 +321,12 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page))
+herr_t
+H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblk_page);
@@ -315,7 +341,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_
/* Decrement reference count on shared info */
if (H5FA__hdr_decr(dblk_page->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblk_page->hdr = NULL;
} /* end if */
@@ -325,6 +352,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_
/* Free the data block page itself */
dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__dblk_page_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblk_page_dest() */
diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c
index 21e2e03..1ccc97d 100644
--- a/src/H5FAdblock.c
+++ b/src/H5FAdblock.c
@@ -88,10 +88,13 @@ H5FL_BLK_DEFINE(fa_page_init);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t *hdr))
+H5FA_dblock_t *
+H5FA__dblock_alloc(H5FA_hdr_t *hdr)
+{
+ H5FA_dblock_t *dblock = NULL; /* fixed array data block */
+ H5FA_dblock_t *ret_value = NULL;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* fixed array data block */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -99,11 +102,11 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate memory for the data block */
if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block")
/* Share common array information */
if (H5FA__hdr_incr(hdr) < 0)
- H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header")
dblock->hdr = hdr;
/* Set non-zero internal fields */
@@ -126,7 +129,7 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate space for 'page init' flags */
if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for page init bitmask")
/* Compute data block page size */
dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM;
@@ -143,19 +146,20 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t
/* Allocate buffer for elements in data block */
H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t);
if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL,
+ "memory allocation failed for data block element buffer")
} /* end else */
/* Set the return value */
ret_value = dblock;
- CATCH
-
+done:
if (!ret_value)
if (dblock && H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block")
-END_FUNC(PKG) /* end H5FA__dblock_alloc() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_create
@@ -169,13 +173,15 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty))
+haddr_t
+H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty)
+{
+ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
+ haddr_t dblock_addr; /* Fixed array data block address */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* Fixed array data block */
- haddr_t dblock_addr; /* Fixed array data block address */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -183,31 +189,35 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Allocate the data block */
if (NULL == (dblock = H5FA__dblock_alloc(hdr)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for fixed array data block")
/* Set size of data block on disk */
hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock);
/* Allocate space for the data block on disk */
if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "file allocation failed for fixed array data block")
dblock->addr = dblock_addr;
/* Don't initialize elements if paged */
if (!dblock->npages)
/* Clear any elements in data block to fill value */
if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0)
- H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "can't set fixed array data block elements to class's fill value")
/* Cache the new fixed array data block */
if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array data block to cache")
inserted = TRUE;
/* Add data block as child of 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add fixed array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
@@ -217,26 +227,28 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Set address of data block to return */
ret_value = dblock_addr;
- CATCH
+done:
if (!H5F_addr_defined(ret_value))
if (dblock) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(dblock) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove fixed array data block from cache")
/* Release data block's disk space */
if (H5F_addr_defined(dblock->addr) &&
H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to release fixed array data block")
/* Destroy data block */
if (H5FA__dblock_dest(dblock) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy fixed array data block")
} /* end if */
-END_FUNC(PKG) /* end H5FA__dblock_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_protect
@@ -250,12 +262,14 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL,
- H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags))
+H5FA_dblock_t *
+H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags)
+{
+ H5FA_dblock_t * dblock = NULL; /* Fixed array data block */
+ H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ H5FA_dblock_t * ret_value = NULL;
- /* Local variables */
- H5FA_dblock_t * dblock; /* Fixed array data block */
- H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -271,31 +285,33 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL,
/* Protect the data block */
if (NULL ==
(dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr)
/* Create top proxy, if it doesn't exist */
if (hdr->top_proxy && NULL == dblock->top_proxy) {
/* Add data block as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
dblock->top_proxy = hdr->top_proxy;
} /* end if */
/* Set return value */
ret_value = dblock;
- CATCH
-
+done:
/* Clean up on error */
if (!ret_value)
/* Release the data block, if it was protected */
if (dblock &&
H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu",
- (unsigned long long)dblock->addr)
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL,
+ "unable to unprotect fixed array data block, address = %llu",
+ (unsigned long long)dblock->addr)
-END_FUNC(PKG) /* end H5FA__dblock_protect() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_unprotect
@@ -309,22 +325,25 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags))
+herr_t
+H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
/* Unprotect the data block */
if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu",
- (unsigned long long)dblock->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array data block, address = %llu",
+ (unsigned long long)dblock->addr)
-END_FUNC(PKG) /* end H5FA__dblock_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_delete
@@ -338,10 +357,13 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr))
+herr_t
+H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr)
+{
+ H5FA_dblock_t *dblock = NULL; /* Pointer to data block */
+ herr_t ret_value = SUCCEED;
- /* Local variables */
- H5FA_dblock_t *dblock = NULL; /* Pointer to data block */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -349,8 +371,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr,
/* Protect data block */
if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu",
- (unsigned long long)dblk_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL,
+ "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr)
/* Check if data block is paged */
if (dblock->npages) {
@@ -365,21 +387,22 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr,
/* Evict the data block page from the metadata cache */
/* (OK to call if it doesn't exist in the cache) */
if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTEXPUNGE, FAIL,
+ "unable to remove array data block page from metadata cache")
/* Advance to next page address */
dblk_page_addr += dblock->dblk_page_size;
} /* end for */
} /* end if */
- CATCH
-
+done:
/* Finished deleting data block in metadata cache */
if (dblock && H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG |
H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block")
-END_FUNC(PKG) /* end H5FA__dblock_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA__dblock_dest
@@ -393,7 +416,12 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dblock))
+herr_t
+H5FA__dblock_dest(H5FA_dblock_t *dblock)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dblock);
@@ -417,7 +445,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl
/* Decrement reference count on shared info */
if (H5FA__hdr_decr(dblock->hdr) < 0)
- H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL,
+ "can't decrement reference count on shared array header")
dblock->hdr = NULL;
} /* end if */
@@ -427,6 +456,6 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dbl
/* Free the data block itself */
dblock = H5FL_FREE(H5FA_dblock_t, dblock);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__dblock_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__dblock_dest() */
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 867160f..aeb3fb1 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -82,17 +82,20 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f))
+H5FA_hdr_t *
+H5FA__hdr_alloc(H5F_t *f)
+{
+ H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */
+ H5FA_hdr_t *ret_value = NULL;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
/* Allocate space for the shared information */
if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for Fixed Array shared header")
/* Set non-zero internal fields */
hdr->addr = HADDR_UNDEF;
@@ -106,13 +109,12 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f))
/* Set the return value */
ret_value = hdr;
- CATCH
-
+done:
if (!ret_value)
if (hdr && H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header")
-
-END_FUNC(PKG) /* end H5FA__hdr_alloc() */
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_alloc() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_init
@@ -126,9 +128,12 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata))
+herr_t
+H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -140,33 +145,36 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void
hdr->stats.nelmts = hdr->cparam.nelmts;
/* Create the callback context, if there's one */
- if (hdr->cparam.cls->crt_context) {
+ if (hdr->cparam.cls->crt_context)
if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata)))
- H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL,
+ "unable to create fixed array client callback context")
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_init() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_init() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_create
*
* Purpose: Creates a new Fixed Array header in the file
*
- * Return: SUCCEED/FAIL
+ * Return: Success: Address of new header in the file
+ * Failure: HADDR_UNDEF
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
- H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata))
+haddr_t
+H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)
+{
+ H5FA_hdr_t *hdr = NULL; /* Fixed array header */
+ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ haddr_t ret_value = HADDR_UNDEF;
- /* Local variables */
- H5FA_hdr_t *hdr = NULL; /* Fixed array header */
- hbool_t inserted = FALSE; /* Whether the header was inserted into cache */
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(f);
@@ -176,17 +184,19 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
{
/* Check for valid parameters */
if (cparam->raw_elmt_size == 0)
- H5E_THROW(H5E_BADVALUE, "element size must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero")
if (cparam->max_dblk_page_nelmts_bits == 0)
- H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF,
+ "max. # of elements bits must be greater than zero")
if (cparam->nelmts == 0)
- H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero")
+ HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# of elements must be greater than zero")
}
#endif /* NDEBUG */
/* Allocate space for the shared information */
if (NULL == (hdr = H5FA__hdr_alloc(f)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF,
+ "memory allocation failed for Fixed Array shared header")
hdr->dblk_addr = HADDR_UNDEF;
@@ -195,50 +205,52 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF,
/* Finish initializing fixed array header */
if (H5FA__hdr_init(hdr, ctx_udata) < 0)
- H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "initialization failed for fixed array header")
/* Allocate space for the header on disk */
if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size)))
- H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header")
/* Create 'top' proxy for extensible array entries */
if (hdr->swmr_write)
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy")
/* Cache the new Fixed Array header */
if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array header to cache")
inserted = TRUE;
/* Add header as child of 'top' proxy */
if (hdr->top_proxy)
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF,
+ "unable to add fixed array entry as child of array proxy")
/* Set address of array header to return */
ret_value = hdr->addr;
- CATCH
-
+done:
if (!H5F_addr_defined(ret_value))
if (hdr) {
/* Remove from cache, if inserted */
if (inserted)
if (H5AC_remove_entry(hdr) < 0)
- H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array header from cache")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF,
+ "unable to remove fixed array header from cache")
/* Release header's disk space */
if (H5F_addr_defined(hdr->addr) &&
H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to free Fixed Array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free Fixed Array header")
/* Destroy header */
if (H5FA__hdr_dest(hdr) < 0)
- H5E_THROW(H5E_CANTFREE, "unable to destroy Fixed Array header")
- } /* end if */
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy Fixed Array header")
+ }
-END_FUNC(PKG) /* end H5FA__hdr_create() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_create() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_incr
@@ -252,7 +264,12 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_incr(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -260,14 +277,14 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if (hdr->rc == 0)
if (H5AC_pin_protected_entry(hdr) < 0)
- H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "unable to pin fixed array header")
/* Increment reference count on shared header */
hdr->rc++;
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_incr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_incr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_decr
@@ -281,7 +298,12 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_decr(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
@@ -294,12 +316,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr))
if (hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
if (H5AC_unpin_entry(hdr) < 0)
- H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header")
- } /* end if */
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header")
+ }
-END_FUNC(PKG) /* end H5FA__hdr_decr() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_decr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_fuse_incr
@@ -313,7 +335,10 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -321,21 +346,28 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr))
/* Increment file reference count on shared header */
hdr->file_rc++;
-END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__hdr_fuse_incr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_fuse_decr
*
* Purpose: Decrement file reference count on shared array header
*
- * Return: SUCCEED/FAIL
+ * Return: Success: The reference count of the header
+ * Failure: Can't fail
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr))
+size_t
+H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr)
+{
+ size_t ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Sanity check */
HDassert(hdr);
@@ -347,7 +379,8 @@ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr))
/* Set return value */
ret_value = hdr->file_rc;
-END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_fuse_decr() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_modified
@@ -361,18 +394,23 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_modified(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_modified(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Mark header as dirty in cache */
if (H5AC_mark_entry_dirty(hdr) < 0)
- H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty")
-END_FUNC(PKG) /* end H5FA__hdr_modified() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_modified() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_protect
@@ -386,12 +424,14 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL,
- H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags))
-
- /* Local variables */
+H5FA_hdr_t *
+H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags)
+{
H5FA_hdr_t * hdr; /* Fixed array header */
H5FA_hdr_cache_ud_t udata; /* User data for cache callbacks */
+ H5FA_hdr_t * ret_value = NULL;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -407,27 +447,28 @@ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL,
/* Protect the header */
if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags)))
- H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu",
- (unsigned long long)fa_addr)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array header, address = %llu",
+ (unsigned long long)fa_addr)
hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */
/* Create top proxy, if it doesn't exist */
if (hdr->swmr_write && NULL == hdr->top_proxy) {
/* Create 'top' proxy for fixed array entries */
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "can't create fixed array entry proxy")
/* Add header as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL,
+ "unable to add fixed array entry as child of array proxy")
+ }
/* Set return value */
ret_value = hdr;
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_protect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_protect() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_unprotect
@@ -441,21 +482,24 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags))
+herr_t
+H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)
+{
+ herr_t ret_value = SUCCEED;
- /* Local variables */
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
/* Unprotect the header */
if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu",
- (unsigned long long)hdr->addr)
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL,
+ "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr)
-END_FUNC(PKG) /* end H5FA__hdr_unprotect() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_unprotect() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_delete
@@ -469,46 +513,49 @@ END_FUNC(PKG) /* end H5FA__hdr_unprotect() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_delete(H5FA_hdr_t *hdr))
-
- /* Local variables */
+herr_t
+H5FA__hdr_delete(H5FA_hdr_t *hdr)
+{
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
#ifndef NDEBUG
- {
- unsigned hdr_status = 0; /* Array header's status in the metadata cache */
- /* Check the array header's status in the metadata cache */
- if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
- H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header")
+ unsigned hdr_status = 0; /* Array header's status in the metadata cache */
+
+ /* Check the array header's status in the metadata cache */
+ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header")
+
+ /* Sanity checks on array header */
+ HDassert(hdr_status & H5AC_ES__IN_CACHE);
+ HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- /* Sanity checks on array header */
- HDassert(hdr_status & H5AC_ES__IN_CACHE);
- HDassert(hdr_status & H5AC_ES__IS_PROTECTED);
- } /* end block */
#endif /* NDEBUG */
/* Check for Fixed Array Data block */
if (H5F_addr_defined(hdr->dblk_addr)) {
/* Delete Fixed Array Data block */
if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0)
- H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block")
+ }
/* Set flags to finish deleting header on unprotect */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
- CATCH
-
+done:
/* Unprotect the header, deleting it if an error hasn't occurred */
if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
+ HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header")
-END_FUNC(PKG) /* end H5FA__hdr_delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_delete() */
/*-------------------------------------------------------------------------
* Function: H5FA__hdr_dest
@@ -522,7 +569,12 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr))
+herr_t
+H5FA__hdr_dest(H5FA_hdr_t *hdr)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(hdr);
@@ -531,20 +583,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr))
/* Destroy the callback context */
if (hdr->cb_ctx) {
if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context")
- } /* end if */
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL,
+ "unable to destroy fixed array client callback context")
+ }
hdr->cb_ctx = NULL;
/* Destroy the 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array 'top' proxy")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy fixed array 'top' proxy")
hdr->top_proxy = NULL;
- } /* end if */
+ }
/* Free the shared info itself */
hdr = H5FL_FREE(H5FA_hdr_t, hdr);
- CATCH
-
-END_FUNC(PKG) /* end H5FA__hdr_dest() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__hdr_dest() */
diff --git a/src/H5FAint.c b/src/H5FAint.c
index 864c7ee..2206901 100644
--- a/src/H5FAint.c
+++ b/src/H5FAint.c
@@ -79,8 +79,12 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -88,11 +92,11 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Create a flush dependency between parent and child entry */
if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency")
-END_FUNC(PKG) /* end H5FA__create_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__create_flush_depend() */
/*-------------------------------------------------------------------------
* Function: H5FA__destroy_flush_depend
@@ -106,8 +110,12 @@ END_FUNC(PKG) /* end H5FA__create_flush_depend() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
- H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
+herr_t
+H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(parent_entry);
@@ -115,8 +123,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL,
/* Destroy a flush dependency between parent and child entry */
if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
- H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
-
- CATCH
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency")
-END_FUNC(PKG) /* end H5FA__destroy_flush_depend() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__destroy_flush_depend() */
diff --git a/src/H5FAstat.c b/src/H5FAstat.c
index 1fdf47f..98f7195 100644
--- a/src/H5FAstat.c
+++ b/src/H5FAstat.c
@@ -78,21 +78,21 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats))
-
-/* Local variables */
+herr_t
+H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats)
+{
+ FUNC_ENTER_NOAPI_NOERR
#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* H5FA_DEBUG */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(fa);
HDassert(stats);
/* Copy fixed array statistics */
H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats));
-END_FUNC(PRIV) /* end H5FA_get_stats() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA_get_stats() */
diff --git a/src/H5FAtest.c b/src/H5FAtest.c
index 6dd6e00..384a657 100644
--- a/src/H5FAtest.c
+++ b/src/H5FAtest.c
@@ -112,14 +112,17 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_UNUSED *udata))
-
- /* Local variables */
+static void *
+H5FA__test_crt_context(void H5_ATTR_UNUSED *udata)
+{
H5FA__test_ctx_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
/* Initialize the context */
ctx->bogus = H5FA__TEST_BOGUS_VAL;
@@ -127,9 +130,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__test_crt_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FA__test_crt_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_dst_context
@@ -143,18 +146,21 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_dst_context(void *_ctx))
-
- /* Local variables */
+static herr_t
+H5FA__test_dst_context(void *_ctx)
+{
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus);
/* Release context structure */
ctx = H5FL_FREE(H5FA__test_ctx_t, ctx);
-END_FUNC(STATIC) /* end H5FA__test_dst_context() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_fill
@@ -168,18 +174,21 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_fill(void *nat_blk, size_t nelmts))
-
- /* Local variables */
+static herr_t
+H5FA__test_fill(void *nat_blk, size_t nelmts)
+{
uint64_t fill_val = H5FA_TEST_FILL; /* Value to fill elements with */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(nat_blk);
HDassert(nelmts);
H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts);
-END_FUNC(STATIC) /* end H5FA__test_fill() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_fill() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_encode
@@ -193,14 +202,15 @@ END_FUNC(STATIC) /* end H5FA__test_fill() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
-#endif /* NDEBUG */
- const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+#endif
+ const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(raw);
@@ -221,7 +231,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
nelmts--;
} /* end while */
-END_FUNC(STATIC) /* end H5FA__test_encode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_encode() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_decode
@@ -235,15 +246,16 @@ END_FUNC(STATIC) /* end H5FA__test_encode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx))
-
-/* Local variables */
+static herr_t
+H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNUSED *_ctx)
+{
#ifndef NDEBUG
H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */
-#endif /* NDEBUG */
- uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
- const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+#endif
+ uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
+
+ FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(raw);
@@ -264,7 +276,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
nelmts--;
} /* end while */
-END_FUNC(STATIC) /* end H5FA__test_decode() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_decode() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_debug
@@ -278,12 +291,13 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
- H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt))
-
- /* Local variables */
+static herr_t
+H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)
+{
char temp_str[128]; /* Temporary string, for formatting */
+ FUNC_ENTER_STATIC_NOERR
+
/* Sanity checks */
HDassert(stream);
HDassert(elmt);
@@ -293,7 +307,8 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -,
HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
(unsigned long long)*(const uint64_t *)elmt);
-END_FUNC(STATIC) /* end H5FA__test_debug() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5FA__test_debug() */
/*-------------------------------------------------------------------------
* Function: H5FA__test_crt_dbg_context
@@ -308,15 +323,17 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
- H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr))
-
- /* Local variables */
+static void *
+H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)
+{
H5FA__test_ctx_t *ctx; /* Context for callbacks */
+ void * ret_value = NULL;
+
+ FUNC_ENTER_STATIC
/* Allocate new context structure */
if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t)))
- H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context")
+ HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context")
/* Initialize the context */
ctx->bogus = H5FA__TEST_BOGUS_VAL;
@@ -324,9 +341,9 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL,
/* Set return value */
ret_value = ctx;
- CATCH
-
-END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5FA__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5FA__get_cparam_test
@@ -340,7 +357,10 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam))
+herr_t
+H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(fa);
@@ -350,22 +370,27 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *f
cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size;
cparam->nelmts = fa->hdr->cparam.nelmts;
-END_FUNC(PKG) /* end H5FA__get_cparam_test() */
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* end H5FA__get_cparam_test() */
/*-------------------------------------------------------------------------
* Function: H5FA__cmp_cparam_test
*
* Purpose: Compare the parameters used to create the fixed array
*
- * Return: SUCCEED/FAIL
+ * Return: An integer value like strcmp
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
- H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2))
+int
+H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)
+{
+ int ret_value = 0;
+
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(cparam1);
@@ -373,10 +398,10 @@ BEGIN_FUNC(PKG, ERRCATCH, int, 0, -,
/* Compare creation parameters for array */
if (cparam1->raw_elmt_size < cparam2->raw_elmt_size)
- H5_LEAVE(-1)
+ ret_value = -1;
else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size)
- H5_LEAVE(1)
+ ret_value = 1;
- CATCH
+ FUNC_LEAVE_NOAPI(ret_value)
-END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */
+} /* end H5FA__cmp_cparam_test() */
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() */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index b46280e..9eb390b 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -250,7 +250,7 @@ H5HL__fl_deserialize(H5HL_t *heap)
heap->freelist = fl;
tail = fl;
fl = NULL;
- } /* end while */
+ }
done:
if (ret_value < 0)
@@ -296,7 +296,7 @@ H5HL__fl_serialize(const H5HL_t *heap)
H5F_ENCODE_LENGTH_LEN(image, H5HL_FREE_NULL, heap->sizeof_size)
H5F_ENCODE_LENGTH_LEN(image, fl->size, heap->sizeof_size)
- } /* end for */
+ }
FUNC_LEAVE_NOAPI_VOID
@@ -450,13 +450,13 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED
/* Build free list */
if (H5HL__fl_deserialize(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
- } /* end if */
+ }
else
/* Note that the heap should _NOT_ be a single
* object in the cache
*/
heap->single_cache_obj = FALSE;
- } /* end if */
+ }
/* Set return value */
ret_value = prfx;
@@ -467,12 +467,12 @@ done:
if (prfx) {
if (FAIL == H5HL__prfx_dest(prfx))
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix");
- } /* end if */
+ }
else {
if (heap && FAIL == H5HL__dest(heap))
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap");
- } /* end else */
- } /* end if */
+ }
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL__cache_prefix_deserialize() */
@@ -588,7 +588,7 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image,
gap = heap->prfx_size - (size_t)(image - (uint8_t *)_image);
HDmemset(image, 0, gap);
image += gap;
- } /* end if */
+ }
/* Serialize the free list into the heap data's image */
H5HL__fl_serialize(heap);
@@ -598,14 +598,14 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image,
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len);
- } /* end if */
+ }
else {
/* Sanity check */
HDassert((size_t)(image - (uint8_t *)_image) <= len);
/* Clear rest of local heap */
HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image));
- } /* end else */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL__cache_prefix_serialize() */
@@ -736,7 +736,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h
/* Build free list */
if (FAIL == H5HL__fl_deserialize(heap))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list");
- } /* end if */
+ }
/* Set return value */
ret_value = dblk;
@@ -892,7 +892,7 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing)
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache")
break;
- } /* end switch */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index 76e4ec0..305014b 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -44,14 +44,17 @@
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
- H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth))
-
+herr_t
+H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
+{
H5HL_t * h = NULL;
int free_block;
H5HL_free_t *freelist;
uint8_t * marker = NULL;
size_t amount_free = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* check arguments */
HDassert(f);
@@ -61,7 +64,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
HDassert(fwidth >= 0);
if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG)))
- H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load/protect local heap")
HDfprintf(stream, "%*sLocal Heap...\n", indent, "");
HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size);
@@ -73,7 +76,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
* the heap.
*/
if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, "");
for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) {
@@ -92,13 +95,13 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
if (marker[freelist->offset + i])
overlap++;
marker[freelist->offset + i] = 1;
- } /* end for */
+ }
if (overlap)
HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
else
amount_free += freelist->size;
- } /* end else */
- } /* end for */
+ }
+ }
if (h->dblk_size)
HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:",
@@ -107,11 +110,12 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
/* Print the data in a VMS-style octal dump */
H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
- CATCH
+done:
if (h && FAIL == H5HL_unprotect(h))
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release/unprotect local heap")
if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker)))
- H5E_THROW(H5E_CANTFREE, "can't free marker buffer");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free marker buffer")
-END_FUNC(PRIV) /* end H5HL_debug() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_debug() */
diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c
index f771de5..9e6fc4a 100644
--- a/src/H5HLdblk.c
+++ b/src/H5HLdblk.c
@@ -81,20 +81,24 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap))
+H5HL_dblk_t *
+H5HL__dblk_new(H5HL_t *heap)
+{
+ H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ H5HL_dblk_t *ret_value = NULL;
- H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
/* Allocate new local heap data block */
if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap data block")
/* 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 data block */
dblk->heap = heap;
@@ -103,13 +107,14 @@ BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap))
/* Set the return value */
ret_value = dblk;
- CATCH
+done:
/* Ensure that the data block memory is deallocated on errors */
if (!ret_value && dblk != NULL)
/* H5FL_FREE always returns NULL so we can't check for errors */
dblk = H5FL_FREE(H5HL_dblk_t, dblk);
-END_FUNC(PKG) /* end H5HL__dblk_new() */
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5HL__dblk_new() */
/*-------------------------------------------------------------------------
* Function: H5HL__dblk_dest
@@ -123,7 +128,12 @@ END_FUNC(PKG) /* end H5HL__dblk_new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk))
+herr_t
+H5HL__dblk_dest(H5HL_dblk_t *dblk)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(dblk);
@@ -135,18 +145,19 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk))
/* Decrement ref. count on heap data structure */
if (FAIL == H5HL__dec_rc(dblk->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 data block */
dblk->heap = NULL;
- } /* end if */
+ }
- CATCH
+done:
/* Free local heap data block */
/* H5FL_FREE always returns NULL so we can't check for errors */
dblk = H5FL_FREE(H5HL_dblk_t, dblk);
-END_FUNC(PKG) /* end H5HL__dblk_dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dblk_dest() */
/*-------------------------------------------------------------------------
* Function: H5HL__dblk_realloc
@@ -160,14 +171,18 @@ END_FUNC(PKG) /* end H5HL__dblk_dest() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size))
-
+herr_t
+H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size)
+{
H5HL_dblk_t *dblk; /* Local heap data block */
haddr_t old_addr; /* Old location of heap data block */
haddr_t new_addr; /* New location of heap data block */
size_t old_heap_size; /* Old size of heap data block */
+ herr_t ret_value = SUCCEED;
- /* check arguments */
+ FUNC_ENTER_PACKAGE
+
+ /* Check arguments */
HDassert(heap);
HDassert(new_heap_size > 0);
@@ -176,12 +191,12 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
old_heap_size = heap->dblk_size;
H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t);
if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)old_heap_size))
- H5E_THROW(H5E_CANTFREE, "can't free old local heap data");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free old local heap data");
/* Allocate new space on disk */
H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t);
if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, (hsize_t)new_heap_size)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for local heap");
/* Update heap info*/
heap->dblk_addr = new_addr;
@@ -197,8 +212,8 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
/* Resize the heap prefix in the cache */
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache");
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache");
+ }
else {
/* Sanity check */
HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr));
@@ -206,50 +221,49 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t
/* Resize the heap data block in the cache */
if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0)
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache");
- } /* end else */
- } /* end if */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap (data block) in cache");
+ }
+ }
else {
/* Check if heap data block was contiguous w/prefix previously */
if (heap->single_cache_obj) {
/* Create new heap data block */
if (NULL == (dblk = H5HL__dblk_new(heap)))
- H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block");
/* Resize current heap prefix */
heap->prfx_size = H5HL_SIZEOF_HDR(f);
if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache");
/* Insert data block into cache (pinned) */
if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG))
- H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block");
dblk = NULL;
/* Reset 'single cache object' flag */
heap->single_cache_obj = FALSE;
- } /* end if */
+ }
else {
/* Resize the heap data block in the cache */
/* (ignore [unlikely] case where heap data block ends up
* contiguous w/heap prefix again.
*/
if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size))
- H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache");
/* Relocate the heap data block in the cache */
if (FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr))
- H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache");
-
- } /* end else */
- } /* end else */
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move heap data block in cache");
+ }
+ }
- CATCH
+done:
/* Restore old heap address & size on errors */
if (FAIL == ret_value) {
heap->dblk_addr = old_addr;
heap->dblk_size = old_heap_size;
- } /* end if */
-
-END_FUNC(PKG) /* end H5HL__dblk_realloc() */
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dblk_realloc() */
diff --git a/src/H5HLint.c b/src/H5HLint.c
index 069bad8..42d6744 100644
--- a/src/H5HLint.c
+++ b/src/H5HLint.c
@@ -80,10 +80,13 @@ H5FL_DEFINE_STATIC(H5HL_t);
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
- H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size))
+H5HL_t *
+H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
+{
+ H5HL_t *heap = NULL; /* New local heap */
+ H5HL_t *ret_value = NULL;
- H5HL_t *heap = NULL; /* New local heap */
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(sizeof_size > 0);
@@ -92,7 +95,7 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
/* Allocate new local heap structure */
if (NULL == (heap = H5FL_CALLOC(H5HL_t)))
- H5E_THROW(H5E_CANTALLOC, "memory allocation failed");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Initialize non-zero fields */
heap->sizeof_size = sizeof_size;
@@ -102,12 +105,13 @@ BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL,
/* Set the return value */
ret_value = heap;
- CATCH
+done:
if (!ret_value && heap != NULL)
if (NULL == (heap = H5FL_FREE(H5HL_t, heap)))
- H5E_THROW(H5E_CANTFREE, "can't free heap memory");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't free heap memory")
-END_FUNC(PKG) /* end H5HL__new() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__new() */
/*-------------------------------------------------------------------------
* Function: H5HL__inc_rc
@@ -121,7 +125,10 @@ END_FUNC(PKG) /* end H5HL__new() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap))
+herr_t
+H5HL__inc_rc(H5HL_t *heap)
+{
+ FUNC_ENTER_PACKAGE_NOERR
/* check arguments */
HDassert(heap);
@@ -129,7 +136,8 @@ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap))
/* Increment heap's ref. count */
heap->rc++;
-END_FUNC(PKG) /* end H5HL__inc_rc() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL__inc_rc() */
/*-------------------------------------------------------------------------
* Function: H5HL__dec_rc
@@ -143,7 +151,12 @@ END_FUNC(PKG) /* end H5HL__inc_rc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap))
+herr_t
+H5HL__dec_rc(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
@@ -151,12 +164,13 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap))
/* Decrement heap's ref. count */
heap->rc--;
- CATCH
/* Check if we should destroy the heap */
if (heap->rc == 0 && FAIL == H5HL__dest(heap))
- H5E_THROW(H5E_CANTFREE, "unable to destroy local heap");
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap");
-END_FUNC(PKG) /* end H5HL__dec_rc() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dec_rc() */
/*-------------------------------------------------------------------------
* Function: H5HL__dest
@@ -170,7 +184,12 @@ END_FUNC(PKG) /* end H5HL__dec_rc() */
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap))
+herr_t
+H5HL__dest(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
/* check arguments */
HDassert(heap);
@@ -181,20 +200,21 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap))
HDassert(heap->prfx == NULL);
HDassert(heap->dblk == NULL);
- CATCH
+ /* Use DONE errors here to try to free as much as possible */
if (heap->dblk_image)
if (NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data block image");
while (heap->freelist) {
H5HL_free_t *fl;
fl = heap->freelist;
heap->freelist = fl->next;
if (NULL != (fl = H5FL_FREE(H5HL_free_t, fl)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap free list");
- } /* end while */
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap free list");
+ }
if (NULL != (heap = H5FL_FREE(H5HL_t, heap)))
- H5E_THROW(H5E_CANTFREE, "unable to free local heap");
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap");
-END_FUNC(PKG) /* end H5HL__dest() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL__dest() */
diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h
index dbac1b9..0ba3b1c 100644
--- a/src/H5HLpkg.h
+++ b/src/H5HLpkg.h
@@ -54,7 +54,7 @@ H5FL_BLK_EXTERN(lheap_chunk);
#define H5_MY_PKG H5HL
#define H5_MY_PKG_ERR H5E_HEAP
#define H5_MY_PKG_INIT NO
-#endif /* H5HL_PACKAGE */
+#endif
#define H5HL_SIZEOF_HDR(F) \
H5HL_ALIGN(H5_SIZEOF_MAGIC + /* heap signature */ \
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() */
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 5c98846..02e07eb 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -66,4 +66,4 @@ H5_DLL herr_t H5HL_unprotect(H5HL_t *heap);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth);
-#endif
+#endif /* H5HLprivate_H */
diff --git a/src/H5private.h b/src/H5private.h
index 7888772..d197465 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -2591,256 +2591,26 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
return (ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-/****************************************/
-/* Revisions to FUNC_ENTER/LEAVE Macros */
-/****************************************/
-
-/* Macros to check if a package is initialized */
-#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg));
-#define H5_CHECK_PACKAGE_INIT_REG_NO(asrt)
-#define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt)
-#define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt)
-#define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg)
-
-/* Macros to initialize package, if a package initialization routine is defined */
-#define H5_PKG_YES_INIT(pkg) \
- if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \
- H5_PACKAGE_INIT_VAR(pkg) = TRUE; \
- if (H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \
- H5_PACKAGE_INIT_VAR(pkg) = FALSE; \
- /* (Can't use H5E_THROW here) */ \
- H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
- ret_value = fail_value; \
- goto func_init_failed; \
- } /* end if */ \
- } /* end if */
-#define H5_PKG_NO_INIT(pkg) \
- if (!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \
- H5_PACKAGE_INIT_VAR(pkg) = TRUE;
-#define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg)
-
/* Macros to declare package initialization function, if a package initialization routine is defined */
#ifdef H5_PKG_SINGLE_SOURCE
#define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
-#else /* H5_PKG_SINGLE_SOURCE */
+#else
#define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void);
-#endif /* H5_PKG_SINGLE_SOURCE */
+#endif
#define H5_PKG_DECLARE_NO_FUNC(pkg)
/* Declare package initialization symbols (if in a package) */
#ifdef H5_PKG_SINGLE_SOURCE
#define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg);
-#else /* H5_PKG_SINGLE_SOURCE */
+#else
#define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg);
-#endif /* H5_PKG_SINGLE_SOURCE */
+#endif
#define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg)
+
#ifdef H5_MY_PKG
H5_PKG_DECLARE_VAR(H5_MY_PKG)
H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG)
-#endif /* H5_MY_PKG */
-
-/* API re-entrance variable */
-extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */
-
-/* Macros for entering different scopes of routines */
-#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \
- FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \
- \
- /* The library should be initialized already */ \
- HDassert(H5_INIT_GLOBAL); \
- \
- /* This interface should be initialized already */ \
- /* (except for package initialization routines :-) */ \
- H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- {
-
-#define H5_PRIVATE_ENTER(pkg, pkg_init) \
- FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \
- \
- /* The library should be initialized already */ \
- HDassert(H5_INIT_GLOBAL); \
- \
- /* Initialize this interface if desired */ \
- H5_PKG_INIT(pkg_init, pkg) \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- { \
- {
-
-#define H5_PUBLIC_ENTER(pkg, pkg_init) \
- FUNC_ENTER_API_VARS \
- FUNC_ENTER_API_THREADSAFE; \
- FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \
- \
- /* Clear thread error stack when entering public functions */ \
- H5E_clear_stack(NULL); \
- \
- /* Initialize the library or bust */ \
- if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \
- if (H5_init_library() < 0) { \
- /* (Can't use H5E_THROW here) */ \
- H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \
- ret_value = fail_value; \
- goto func_init_failed; \
- } /* end if */ \
- } /* end if */ \
- \
- /* Initialize this interface if desired */ \
- H5_PKG_INIT(pkg_init, pkg) \
- \
- /* Check for re-entering API routine */ \
- HDassert(!H5_api_entered_g); \
- H5_api_entered_g = TRUE; \
- \
- /* Start logging MPI's MPE information */ \
- BEGIN_MPE_LOG \
- \
- /* Push the name of this function on the function stack */ \
- H5_PUSH_FUNC \
- \
- /* Enter scope for this type of function */ \
- { \
- { \
- {
-
-/* Macros for substituting the package name */
-#define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
-#define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT)
-#define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG)
-#define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init)
-#define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init)
-
-/* Macros for substituting a function prefix */
-#define FUNC_PREFIX_STATIC static
-#define FUNC_PREFIX_PKGINIT
-#define FUNC_PREFIX_PKG
-#define FUNC_PREFIX_PRIV
-#define FUNC_PREFIX_PUB
-
-/* Macros for declaring error variables */
-/* Function can detect errors and has a specific error return value */
-#define FUNC_ERR_VAR_ERR(ret_typ, err) \
- hbool_t past_catch = FALSE; \
- ret_typ fail_value = err;
-/* Function can detect errors but cannot return an error value (Cleanup only) */
-#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) hbool_t past_catch = FALSE;
-/* Function has no need to detect or clean up from errors */
-#define FUNC_ERR_VAR_NOERR(ret_typ, err)
-
-/* Use this macro when entering all functions */
-#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \
- H5_GLUE(FUNC_PREFIX_, scope) \
- ret_typ func \
- /* Open function */ \
- { \
- ret_typ ret_value = ret_init; \
- H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT)
-
-/* Use this macro when entering functions that have no return value */
-#define BEGIN_FUNC_VOID(scope, use_err, func) \
- H5_GLUE(FUNC_PREFIX_, scope) \
- void func \
- /* Open function */ \
- { \
- H5_GLUE(FUNC_ERR_VAR_, use_err)(void, -, -) H5_GLUE(FUNC_ENT_, scope)
-
-/* Macros for label when a function initialization can fail */
-#define H5_PRIV_YES_FUNC_INIT_FAILED \
-func_init_failed:
-#define H5_PRIV_NO_FUNC_INIT_FAILED
-#define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED)
-
-/* Macros for leaving different scopes of routines */
-#define FUNC_LEAVE_PKGINIT \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_STATIC \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PKG \
- /* Leave scope for this type of function */ \
- } \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PRIV \
- /* Leave scope for this type of function */ \
- } \
- } \
- \
- /* Label for errors during FUNC_ENTER */ \
- H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC
-
-#define FUNC_LEAVE_PUB \
- /* Leave scope for this type of function */ \
- } \
- } \
- } \
- \
- /* Label for errors during FUNC_ENTER */ \
-func_init_failed: \
- \
- /* Dump error stack if an error occurred during API routine */ \
- if (ret_value == fail_value) \
- (void)H5E_dump_api_stack(TRUE); \
- \
- /* Finish the API tracing info */ \
- H5TRACE_RETURN(ret_value); \
- \
- /* Pop the name of this function off the function stack */ \
- H5_POP_FUNC \
- \
- /* Finish the MPE tracing info */ \
- FINISH_MPE_LOG \
- \
- /* Check for leaving API routine */ \
- HDassert(H5_api_entered_g); \
- H5_api_entered_g = FALSE; \
- \
- /* Release thread-safety semaphore */ \
- FUNC_LEAVE_API_THREADSAFE
-
-/* Use this macro when leaving all functions */
-#define END_FUNC(scope) \
- /* Scope-specific function conclusion */ \
- H5_GLUE(FUNC_LEAVE_, scope) \
- \
- /* Leave routine */ \
- return (ret_value); \
- \
- /* Close Function */ \
- }
-
-/* Use this macro when leaving void functions */
-#define END_FUNC_VOID(scope) \
- /* Scope-specific function conclusion */ \
- H5_GLUE(FUNC_LEAVE_, scope) \
- \
- /* Leave routine */ \
- return; \
- \
- /* Close Function */ \
- }
+#endif
/* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient).
* Make sure to use HGOTO_ERROR_TAG and HGOTO_DONE_TAG between these macros! */
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index 8fd33bb..5840a98 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -220,22 +220,22 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
/* Macro for "catching" flow of control when an error occurs. Note that the
* H5_LEAVE macro won't jump back here once it's past this point.
*/
-/* #define CATCH catch_except:; past_catch = TRUE; defined in H5Eprivate.h */
+#define CATCH \
+catch_except:; \
+ past_catch = TRUE;
/*
- * H5_LEAVE macro, used to facilitate control flow between a
- * BEGIN_FUNC() and an END_FUNC() within a function body. The argument is
- * the return value.
- * The return value is assigned to a variable `ret_value' and control branches
- * to the `catch_except' label, if we're not already past it.
+ * H5_LEAVE macro, used to facilitate control flow in a function. The argument
+ * is the return value. The return value is assigned to a variable `ret_value'
+ * and control branches to the `catch_except' label, if we're not already past
+ * it.
*/
-/*
- * #define H5_LEAVE(v) { \
- * ret_value = v; \
- * if(!past_catch) \
- * goto catch_except; \
- * }
- * defined in H5Eprivate.h */
+#define H5_LEAVE(v) \
+ { \
+ ret_value = v; \
+ if (!past_catch) \
+ goto catch_except; \
+ }
/*
* H5TOOLS_THROW macro, used to facilitate error reporting within a function body.