diff options
author | Sean McBride <sean@rogue-research.com> | 2023-08-02 13:39:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 13:39:15 (GMT) |
commit | 2b0badb90e4e516d0758efbd8ec96449188c7249 (patch) | |
tree | 074e38039b95ca7121a0117069974eff52a04519 /src/H5FAhdr.c | |
parent | 56451503c55ef6e5f67fc3bb710f9e5b649b1af2 (diff) | |
download | hdf5-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/H5FAhdr.c')
-rw-r--r-- | src/H5FAhdr.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 419a933..37d3e39 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -91,7 +91,8 @@ H5FA__hdr_alloc(H5F_t *f) /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "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; @@ -141,7 +142,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata) if (hdr->cparam.cls->crt_context) if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, - "unable to create fixed array client callback context") + "unable to create fixed array client callback context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -174,19 +175,19 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) { /* Check for valid parameters */ if (cparam->raw_elmt_size == 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "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) HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, - "max. # of elements bits must be greater than zero") + "max. # of elements bits must be greater than zero"); if (cparam->nelmts == 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# 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))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for Fixed Array shared header") + "memory allocation failed for Fixed Array shared header"); hdr->dblk_addr = HADDR_UNDEF; @@ -195,27 +196,27 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) /* Finish initializing fixed array header */ if (H5FA__hdr_init(hdr, ctx_udata) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "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))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "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())) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "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) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "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) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); /* Set address of array header to return */ ret_value = hdr->addr; @@ -264,7 +265,7 @@ 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) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "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++; @@ -300,7 +301,7 @@ H5FA__hdr_decr(H5FA_hdr_t *hdr) if (hdr->rc == 0) { assert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header"); } done: @@ -381,7 +382,7 @@ H5FA__hdr_modified(H5FA_hdr_t *hdr) /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -420,19 +421,19 @@ H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags) /* Protect the header */ if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) + (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())) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "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) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); } /* Set return value */ @@ -464,7 +465,7 @@ H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags) /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr) + "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -497,7 +498,7 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) /* 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") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header"); /* Sanity checks on array header */ assert(hdr_status & H5AC_ES__IN_CACHE); @@ -509,7 +510,7 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) if (H5_addr_defined(hdr->dblk_addr)) { /* Delete Fixed Array Data block */ if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block"); } /* Set flags to finish deleting header on unprotect */ @@ -547,14 +548,14 @@ H5FA__hdr_dest(H5FA_hdr_t *hdr) if (hdr->cb_ctx) { if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, - "unable to destroy fixed array client callback context") + "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) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "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; } |