summaryrefslogtreecommitdiffstats
path: root/src/H5B2hdr.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-08-03 12:57:29 (GMT)
committerGitHub <noreply@github.com>2023-08-03 12:57:29 (GMT)
commit7fc8531b767855e69fb4016783a1131ba581fd5b (patch)
treea243310b99da59c858ae4eaeed8c452e0177bba4 /src/H5B2hdr.c
parenta77d8bfcd7d066c6759b0346c02cbd612f90b7c2 (diff)
downloadhdf5-7fc8531b767855e69fb4016783a1131ba581fd5b.zip
hdf5-7fc8531b767855e69fb4016783a1131ba581fd5b.tar.gz
hdf5-7fc8531b767855e69fb4016783a1131ba581fd5b.tar.bz2
Merge Made HGOTO_ERROR a do-while loop changes from develop (#3334)
Diffstat (limited to 'src/H5B2hdr.c')
-rw-r--r--src/H5B2hdr.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 49d5593..c4ffea2 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -128,12 +128,12 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui
/* Allocate "page" for node I/O */
if (NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed");
memset(hdr->page, 0, hdr->node_size);
/* Allocate array of node info structs */
if (NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1))))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed");
/* Initialize leaf node info */
sz_max_nrec = H5B2_NUM_LEAF_REC(hdr->node_size, hdr->rrec_size);
@@ -144,13 +144,13 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui
hdr->node_info[0].cum_max_nrec_size = 0;
if (NULL ==
(hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory");
hdr->node_info[0].node_ptr_fac = NULL;
/* Allocate array of pointers to internal node native keys */
/* (uses leaf # of records because its the largest) */
if (NULL == (hdr->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)hdr->node_info[0].max_nrec)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed");
/* Initialize offsets in native key block */
/* (uses leaf # of records because its the largest) */
@@ -181,11 +181,11 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui
if (NULL == (hdr->node_info[u].nat_rec_fac =
H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory");
if (NULL == (hdr->node_info[u].node_ptr_fac =
H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL,
- "can't create internal 'branch' node node pointer block factory")
+ "can't create internal 'branch' node node pointer block factory");
} /* end for */
} /* end if */
@@ -199,7 +199,8 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui
/* Create the callback context, if the callback exists */
if (hdr->cls->crt_context)
if (NULL == (hdr->cb_ctx = (*hdr->cls->crt_context)(ctx_udata)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "unable to create v2 B-tree client callback context")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL,
+ "unable to create v2 B-tree client callback context");
done:
if (ret_value < 0)
@@ -233,7 +234,7 @@ H5B2__hdr_alloc(H5F_t *f)
/* Allocate space for the shared information */
if (NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header");
/* Assign non-zero information */
hdr->f = f;
@@ -276,31 +277,31 @@ H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
/* Allocate v2 B-tree header */
if (NULL == (hdr = H5B2__hdr_alloc(f)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header");
/* Initialize shared B-tree info */
if (H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info");
/* Allocate space for the header on disk */
if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)hdr->hdr_size)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header");
/* Create 'top' proxy for extensible array entries */
if (hdr->swmr_write)
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, HADDR_UNDEF, "can't create v2 B-tree proxy")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, HADDR_UNDEF, "can't create v2 B-tree proxy");
/* Cache the new B-tree node */
if (H5AC_insert_entry(f, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree 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)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, HADDR_UNDEF,
- "unable to add v2 B-tree header as child of array proxy")
+ "unable to add v2 B-tree header as child of array proxy");
/* Set address of v2 B-tree header to return */
ret_value = hdr->addr;
@@ -349,7 +350,7 @@ H5B2__hdr_incr(H5B2_hdr_t *hdr)
/* Mark header as un-evictable when a B-tree node is depending on it */
if (hdr->rc == 0)
if (H5AC_pin_protected_entry(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header");
/* Increment reference count on B-tree header */
hdr->rc++;
@@ -384,7 +385,7 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr)
/* Mark header as evictable again when no nodes depend on it */
if (hdr->rc == 0)
if (H5AC_unpin_entry(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -458,7 +459,7 @@ H5B2__hdr_dirty(H5B2_hdr_t *hdr)
/* Mark B-tree header as dirty in cache */
if (H5AC_mark_entry_dirty(hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -497,18 +498,18 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags)
/* Protect the header */
if (NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, H5AC_BT2_HDR, hdr_addr, &udata, flags)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load v2 B-tree header, address = %llu",
- (unsigned long long)hdr_addr)
+ (unsigned long long)hdr_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 v2 B-tree entries */
if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create()))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, NULL, "can't create v2 B-tree proxy")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, NULL, "can't create v2 B-tree proxy");
/* Add header as child of 'top' proxy */
if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree header as child of proxy")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree header as child of proxy");
} /* end if */
/* Set return value */
@@ -548,7 +549,7 @@ H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags)
/* Unprotect the header */
if (H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL,
- "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr)
+ "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -576,7 +577,7 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
/* Destroy the callback context */
if (hdr->cb_ctx) {
if ((*hdr->cls->dst_context)(hdr->cb_ctx) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy v2 B-tree client callback context")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy v2 B-tree client callback context");
hdr->cb_ctx = NULL;
} /* end if */
@@ -597,11 +598,11 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
if (hdr->node_info[u].nat_rec_fac)
if (H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL,
- "can't destroy node's native record block factory")
+ "can't destroy node's native record block factory");
if (hdr->node_info[u].node_ptr_fac)
if (H5FL_fac_term(hdr->node_info[u].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL,
- "can't destroy node's node pointer block factory")
+ "can't destroy node's node pointer block factory");
} /* end for */
/* Free the array of node info structs */
@@ -617,7 +618,7 @@ H5B2__hdr_free(H5B2_hdr_t *hdr)
/* Destroy the 'top' proxy */
if (hdr->top_proxy) {
if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to destroy v2 B-tree 'top' proxy")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to destroy v2 B-tree 'top' proxy");
hdr->top_proxy = NULL;
} /* end if */
@@ -655,7 +656,7 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr)
/* Check the v2 B-tree header's status in the metadata cache */
if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL,
- "unable to check metadata cache status for v2 B-tree header")
+ "unable to check metadata cache status for v2 B-tree header");
/* Sanity checks on v2 B-tree header */
assert(hdr_status & H5AC_ES__IN_CACHE);
@@ -666,7 +667,7 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr)
/* Delete all nodes in B-tree */
if (H5_addr_defined(hdr->root.addr))
if (H5B2__delete_node(hdr, hdr->depth, &hdr->root, hdr, hdr->remove_op, hdr->remove_op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes");
/* Indicate that the heap header should be deleted & file space freed */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;