summaryrefslogtreecommitdiffstats
path: root/src/H5HFman.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2023-08-02 13:39:15 (GMT)
committerGitHub <noreply@github.com>2023-08-02 13:39:15 (GMT)
commit2b0badb90e4e516d0758efbd8ec96449188c7249 (patch)
tree074e38039b95ca7121a0117069974eff52a04519 /src/H5HFman.c
parent56451503c55ef6e5f67fc3bb710f9e5b649b1af2 (diff)
downloadhdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.zip
hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.gz
hdf5-2b0badb90e4e516d0758efbd8ec96449188c7249.tar.bz2
Made HGOTO_ERROR a do-while loop (#3308)
* Made HGOTO_ERROR a do-while loop
Diffstat (limited to 'src/H5HFman.c')
-rw-r--r--src/H5HFman.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 83c1585..d5075c0 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -46,7 +46,7 @@
if (!((HDR)->checked_filters)) { \
if ((HDR)->pline.nused) \
if (H5Z_can_apply_direct(&((HDR)->pline)) < 0) \
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "I/O filters can't operate on this heap") \
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "I/O filters can't operate on this heap"); \
\
(HDR)->checked_filters = TRUE; \
} /* end if */ \
@@ -114,13 +114,13 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
/* Look for free space */
if ((node_found = H5HF__space_find(hdr, (hsize_t)obj_size, &sec_node)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap");
/* If we didn't find a node, go create a direct block big enough to hold the requested block */
if (!node_found)
/* Allocate direct block big enough to hold requested size */
if (H5HF__man_dblock_new(hdr, obj_size, &sec_node) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block");
/* Check for row section */
if (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ||
@@ -128,24 +128,24 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
/* Allocate 'single' selection out of 'row' selection */
if (H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section");
} /* end if */
assert(sec_node->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
/* Check for 'single' section being serialized */
if (sec_node->sect_info.state == H5FS_SECT_SERIALIZED)
if (H5HF__sect_single_revive(hdr, sec_node) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section");
assert(sec_node->sect_info.state == H5FS_SECT_LIVE);
/* Retrieve direct block address from section */
if (H5HF__sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information");
/* Lock direct block */
if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, sec_node->u.single.parent,
sec_node->u.single.par_entry, H5AC__NO_FLAGS_SET)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block");
/* Insert object into block */
@@ -158,7 +158,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
/* Reduce (& possibly re-add) single section */
if (H5HF__sect_single_reduce(hdr, sec_node, obj_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node");
sec_node = NULL;
/* Encode the object in the block */
@@ -184,7 +184,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id)
/* Reduce space available in heap (marks header dirty) */
if (H5HF__hdr_adj_free(hdr, -(ssize_t)obj_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap");
done:
/* Release section node on error */
@@ -322,15 +322,15 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Check for bad offset or length */
if (obj_off == 0)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset");
if (obj_off > hdr->man_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large");
if (obj_len == 0)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size");
if (obj_len > hdr->man_dtable.cparam.max_direct_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block");
if (obj_len > hdr->max_man_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone");
/* Check for root direct block */
if (hdr->man_dtable.curr_root_rows == 0) {
@@ -341,7 +341,7 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Lock direct block */
if (NULL ==
(dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, NULL, 0, dblock_access_flags)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block");
} /* end if */
else {
H5HF_indirect_t *iblock; /* Pointer to indirect block */
@@ -350,7 +350,7 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Look up indirect block containing direct block */
if (H5HF__man_dblock_locate(hdr, obj_off, &iblock, &entry, &did_protect, H5AC__READ_ONLY_FLAG) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section");
/* Set direct block info */
dblock_addr = iblock->ents[entry].addr;
@@ -363,9 +363,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Unlock indirect block */
if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL,
- "unable to release fractal heap indirect block")
+ "unable to release fractal heap indirect block");
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block");
} /* end if */
/* Lock direct block */
@@ -374,14 +374,14 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Unlock indirect block */
if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL,
- "unable to release fractal heap indirect block")
+ "unable to release fractal heap indirect block");
- HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block");
} /* end if */
/* Unlock indirect block */
if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block");
iblock = NULL;
} /* end else */
@@ -391,18 +391,18 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *
/* Check for object's offset in the direct block prefix information */
if (blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block");
/* Check for object's length overrunning the end of the direct block */
if ((blk_off + obj_len) > dblock_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block");
/* Point to location for object */
p = dblock->blk + blk_off;
/* Call the user's 'op' callback */
if (op(p, obj_len, op_data) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed");
done:
/* Unlock direct block */
@@ -437,7 +437,7 @@ H5HF__man_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj)
/* Call the internal 'op' routine routine */
if (H5HF__man_op_real(hdr, id, H5HF__op_read, obj, 0) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -474,7 +474,7 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj)
*/
H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object");
H5_GCC_CLANG_DIAG_ON("cast-qual")
done:
@@ -506,7 +506,7 @@ H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_da
/* Call the internal 'op' routine routine */
if (H5HF__man_op_real(hdr, id, op, op_data, 0) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -555,15 +555,15 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id)
/* Check for bad offset or length */
if (obj_off == 0)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset");
if (obj_off > hdr->man_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large");
if (obj_len == 0)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size");
if (obj_len > hdr->man_dtable.cparam.max_direct_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block");
if (obj_len > hdr->max_man_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone");
/* Check for root direct block */
if (hdr->man_dtable.curr_root_rows == 0) {
@@ -576,11 +576,11 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id)
/* Look up indirect block containing direct block */
if (H5HF__man_dblock_locate(hdr, obj_off, &iblock, &dblock_entry, &did_protect, H5AC__NO_FLAGS_SET) <
0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section");
/* Check for offset of invalid direct block */
if (!H5_addr_defined(iblock->ents[dblock_entry].addr))
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block");
/* Set direct block info */
H5_CHECK_OVERFLOW((hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width]),
@@ -601,33 +601,33 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id)
/* Check for object's offset in the direct block prefix information */
if (blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block");
/* Check for object's length overrunning the end of the direct block */
if ((blk_off + obj_len) > dblock_size)
- HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block");
/* Create free space section node */
if (NULL == (sec_node = H5HF__sect_single_new(obj_off, obj_len, iblock, dblock_entry)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space");
/* Unlock indirect block */
if (iblock) {
if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block");
iblock = NULL;
} /* end if */
/* Increase space available in heap (marks header dirty) */
if (H5HF__hdr_adj_free(hdr, (ssize_t)obj_len) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap");
/* Update statistics about heap */
hdr->man_nobjs--;
/* Return free space to the heap's list of space */
if (H5HF__space_add(hdr, sec_node, H5FS_ADD_RETURNED_SPACE) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list");
sec_node = NULL;
done: