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/H5Plapl.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/H5Plapl.c')
-rw-r--r-- | src/H5Plapl.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 1c573dc..19a63bc 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -189,7 +189,7 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) /* Register property for number of links traversed */ if (H5P__register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link prefix */ if (H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, @@ -197,33 +197,33 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register fapl for link access */ if (H5P__register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link file access flags */ if (H5P__register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link file traversal callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if (H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #endif /* H5_HAVE_PARALLEL */ done: @@ -260,9 +260,9 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -299,9 +299,9 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -335,7 +335,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* Check for non-default FAPL */ if (*elink_fapl != H5P_DEFAULT) { if (NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list"); non_default_fapl = TRUE; } /* end if */ @@ -348,7 +348,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* (if *pp == NULL, will only compute the size) */ if (non_default_fapl) { if (H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list"); if (*pp) { uint64_t enc_value; @@ -363,7 +363,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* encode the plist */ if (H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list"); *pp += fapl_size; } @@ -420,7 +420,7 @@ H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) /* Decode the property list */ if ((*elink_fapl = H5P__decode(*pp)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property"); *pp += fapl_size; } /* end if */ @@ -458,7 +458,7 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED /* Close the FAPL */ if (l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -493,9 +493,9 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -575,7 +575,7 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /* Close the FAPL */ if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -723,7 +723,7 @@ H5P__lacc_elink_pref_dec(const void **_pp, void *_value) if (0 != len) { /* Make a copy of the user's prefix string */ if (NULL == (*elink_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); HDstrncpy(*elink_pref, *(const char **)pp, len); (*elink_pref)[len] = '\0'; @@ -863,11 +863,11 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set number of links */ if (H5P_set(plist, H5L_ACS_NLINKS_NAME, &nlinks) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info"); done: FUNC_LEAVE_API(ret_value) @@ -900,11 +900,11 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current number of links */ if (H5P_get(plist, H5L_ACS_NLINKS_NAME, nlinks) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links"); done: FUNC_LEAVE_API(ret_value) @@ -932,11 +932,11 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set prefix */ if (H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info"); done: FUNC_LEAVE_API(ret_value) @@ -968,11 +968,11 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current prefix */ if (H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix"); /* Check for prefix being set */ if (my_prefix) { @@ -1018,7 +1018,7 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) /* Set the file access property list for the link access */ if (H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link"); done: FUNC_LEAVE_API(ret_value) @@ -1045,10 +1045,10 @@ H5Pget_elink_fapl(hid_t lapl_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links"); done: FUNC_LEAVE_API(ret_value) @@ -1078,15 +1078,15 @@ H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags) if ((flags != H5F_ACC_RDWR) && (flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) && (flags != H5F_ACC_RDONLY) && (flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) && (flags != H5F_ACC_DEFAULT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set flags */ if (H5P_set(plist, H5L_ACS_ELINK_FLAGS_NAME, &flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access flags"); done: FUNC_LEAVE_API(ret_value) @@ -1113,12 +1113,12 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get flags */ if (flags) if (H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags"); done: FUNC_LEAVE_API(ret_value) @@ -1148,11 +1148,11 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) /* Check if the callback function is NULL and the user data is non-NULL. * This is almost certainly an error as the user data will not be used. */ if (!func && op_data) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Populate the callback info struct */ cb_info.func = func; @@ -1160,7 +1160,7 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) /* Set callback info */ if (H5P_set(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info"); done: FUNC_LEAVE_API(ret_value) @@ -1188,11 +1188,11 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func /*out*/, void **op_dat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get callback_info */ if (H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info"); if (func) *func = cb_info.func; |