diff options
54 files changed, 687 insertions, 1723 deletions
@@ -251,7 +251,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -271,13 +270,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Go do the real work for attaching the attribute to the object */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) @@ -291,8 +286,6 @@ done: /* Cleanup on failure */ if(ret_value < 0 && attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Acreate2() */ @@ -337,7 +330,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -360,13 +352,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -386,8 +374,6 @@ done: /* Cleanup on failure */ if(ret_value < 0 && attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -417,7 +403,6 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -431,13 +416,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Read in attribute from object header */ if(NULL == (attr = H5A__open(&loc, attr_name))) @@ -452,8 +433,6 @@ done: if(ret_value < 0) if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -486,7 +465,6 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -502,13 +480,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -529,8 +503,6 @@ done: if(ret_value < 0) if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_name() */ @@ -566,7 +538,6 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -585,13 +556,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") if(H5P_DEFAULT != lapl_id) { if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) @@ -612,8 +579,6 @@ done: if(ret_value < 0) if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -640,7 +605,6 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -654,21 +618,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(attr_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(attr_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Go write the actual data to the attribute */ if((ret_value = H5A__write(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Awrite() */ @@ -694,7 +652,6 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -708,18 +665,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Go write the actual data to the attribute */ if((ret_value = H5A__read(attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aread() */ @@ -780,7 +730,6 @@ hid_t H5Aget_type(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -790,17 +739,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - if((ret_value = H5A__get_type(attr)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -916,7 +858,6 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -935,13 +876,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) @@ -961,8 +898,6 @@ done: /* Release resources */ if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Aget_name_by_idx() */ @@ -1060,7 +995,6 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1078,13 +1012,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_name(&loc, obj_name, attr_name))) @@ -1098,8 +1028,6 @@ done: /* Release resources */ if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_name() */ @@ -1125,7 +1053,6 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1146,13 +1073,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_idx(&loc, obj_name, idx_type, order, n))) @@ -1166,8 +1089,6 @@ done: /* Release resources */ if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_idx() */ @@ -1189,7 +1110,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1208,13 +1128,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Call private attribute rename routine */ if(H5A__rename(&loc, old_name, new_name) < 0) @@ -1222,8 +1138,6 @@ if(H5CX_set_loc(loc_id, TRUE) < 0) } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Arename() */ @@ -1245,7 +1159,6 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1266,13 +1179,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(HDstrcmp(old_attr_name, new_attr_name)) { H5G_loc_t loc; /* Object location */ -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") @@ -1283,8 +1192,6 @@ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Arename_by_name() */ @@ -1334,7 +1241,6 @@ herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1348,18 +1254,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call attribute iteration routine */ if((ret_value = H5A__iterate(loc_id, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aiterate2() */ @@ -1413,7 +1312,6 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1432,21 +1330,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Call attribute iteration by name routine */ if((ret_value = H5A__iterate_by_name(&loc, obj_name, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aiterate_by_name() */ @@ -1469,7 +1361,6 @@ herr_t H5Adelete(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1483,21 +1374,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Delete the attribute from the location */ if(H5A__delete(&loc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Adelete() */ @@ -1523,7 +1408,6 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1539,21 +1423,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Delete the attribute from the location */ if(H5A__delete_by_name(&loc, obj_name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Adelete_by_name() */ @@ -1587,7 +1465,6 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1605,21 +1482,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") /* Delete the attribute from the location */ if(H5A__delete_by_idx(&loc, obj_name, idx_type, order, n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Adelete_by_idx() */ @@ -1642,7 +1513,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Aclose(hid_t attr_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1651,17 +1521,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* check arguments */ if(NULL == H5I_object_verify(attr_id, H5I_ATTR)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Decrement references to that atom (and close it) */ if(H5I_dec_app_ref(attr_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't close attribute") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aclose() */ @@ -1684,7 +1549,6 @@ htri_t H5Aexists(hid_t obj_id, const char *attr_name) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1698,18 +1562,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Check if the attribute exists */ if((ret_value = H5A__exists(&loc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aexists() */ @@ -1732,7 +1589,6 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1748,20 +1604,14 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") if ((ret_value = H5A__exists_by_name(loc, obj_name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aexists_by_name() */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 1e031f7..84ab491 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -117,7 +117,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -137,13 +136,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A__create(&loc, name, type, space, acpl_id))) @@ -157,8 +152,6 @@ done: /* Cleanup on failure */ if(ret_value < 0 && attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Acreate1() */ @@ -191,7 +184,6 @@ H5Aopen_name(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -205,11 +197,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_name(&loc, ".", name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) @@ -223,8 +210,6 @@ done: if(ret_value < 0) if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -257,7 +242,6 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -269,11 +253,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open the attribute in the object header */ if(NULL == (attr = H5A__open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") @@ -287,8 +266,6 @@ done: if(ret_value < 0) if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -317,7 +294,6 @@ H5Aget_num_attrs(hid_t loc_id) { H5O_loc_t *loc; /* Object location for attribute */ void *obj; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ int ret_value; FUNC_ENTER_API(FAIL) @@ -363,18 +339,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") } /*lint !e788 All appropriate cases are covered */ -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Look up the # of attributes for the object */ if((ret_value = H5A__get_num_attrs(loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aget_num_attrs() */ @@ -419,7 +388,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -429,18 +397,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call attribute iteration routine */ if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Aiterate1() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Atest.c b/src/H5Atest.c index f7b7fd3..31fbe8e 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -127,7 +127,7 @@ herr_t H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) { H5A_t *attr; /* Attribute object for ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -135,9 +135,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check arguments */ if(NULL == (attr = (H5A_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Sanity check */ HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); @@ -147,8 +149,9 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_shared_rc_test() */ @@ -136,9 +136,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Create the new dataset & get its ID */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) @@ -215,9 +215,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* build and open the new dataset */ if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) @@ -283,9 +283,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id))) @@ -753,8 +753,8 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Call internal routine */ ret_value = H5D_vlen_reclaim(type_id, space, buf); @@ -897,9 +897,9 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dset_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dset_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Private function */ if(H5D__set_extent(dset, size) < 0) @@ -935,9 +935,9 @@ H5Dflush(hid_t dset_id) if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dset_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dset_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush dataset information cached in memory */ if(H5D__flush(dset, dset_id) < 0) @@ -973,9 +973,9 @@ H5Drefresh(hid_t dset_id) if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dset_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dset_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call private function to refresh the dataset object */ if((H5D__refresh(dset_id, dset)) < 0) @@ -1015,9 +1015,9 @@ H5Dformat_convert(hid_t dset_id) if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dset_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dset_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") switch(dset->shared->layout.type) { case H5D_CHUNKED: diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 656fa91..347e34c 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -78,7 +78,6 @@ herr_t H5Ddebug(hid_t dset_id) { H5D_t *dset; /* Dataset to debug */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -87,10 +86,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check args */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) @@ -99,8 +94,6 @@ api_ctx_pushed = TRUE; HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ddebug() */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 51ebeba..318680c 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -116,7 +116,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ hid_t dapl_id = H5P_DEFAULT; /* DAPL used by library */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -137,13 +136,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Build and open the new dataset */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, dapl_id))) @@ -157,8 +152,6 @@ done: if(ret_value < 0) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ @@ -186,7 +179,6 @@ H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -198,11 +190,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") @@ -215,8 +202,6 @@ done: if(ret_value < 0) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ @@ -244,7 +229,6 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) H5D_t *dset; /* Pointer to dataset to modify */ hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ unsigned u; /* Local index variable */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -264,21 +248,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(size[u] > dset_dims[u]) dset_dims[u] = size[u]; -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dset_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dset_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ if(H5D__set_extent(dset, dset_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Dextend() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 668ecc3..e42e551 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -120,7 +120,6 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ H5S_t *space; /* Dataspace */ H5T_t *fill_type; /* Fill-value datatype */ H5T_t *buf_type; /* Buffer datatype */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -135,17 +134,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") if(NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Fill the selection in the memory buffer */ if(H5D__fill(fill, fill_type, buf, buf_type, space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Dfill() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 5b5bb5e..334f18f 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -118,7 +118,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; hbool_t direct_read = FALSE; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -159,12 +158,8 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Retrieve the 'direct read' flag */ if(H5CX_get_dcr_flag(&direct_read) < 0) @@ -216,9 +211,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") - FUNC_LEAVE_API(ret_value) } /* end H5Dread() */ @@ -262,7 +254,6 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; hbool_t direct_write = FALSE; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -282,12 +273,8 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Retrieve the 'direct write' flag */ if(H5CX_get_dcw_flag(&direct_write) < 0) @@ -320,9 +307,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") - FUNC_LEAVE_API(ret_value) } /* end H5Dwrite() */ diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index f636eb7..5856ede 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -955,7 +955,6 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, size_t type_size; /* Datatype element size */ hssize_t nelmts; /* Number of remaining elements in selection */ size_t nelmts_scatter = 0; /* Number of elements to scatter to dst_buf */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -970,10 +969,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if(dst_buf == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Get datatype element size */ if(0 == (type_size = H5T_GET_SIZE(type))) @@ -1024,8 +1019,6 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") if(iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Dscatter() */ @@ -1059,7 +1052,6 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, hssize_t nelmts; /* Number of remaining elements in selection */ size_t dst_buf_nelmts; /* Number of elements that can fit in dst_buf */ size_t nelmts_gathered; /* Number of elements gathered from src_buf */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1077,10 +1069,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0") if(dst_buf == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Get datatype element size */ if(0 == (type_size = H5T_GET_SIZE(type))) @@ -1130,8 +1118,6 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") if(iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Dgather() */ @@ -355,7 +355,6 @@ done: htri_t H5Fis_hdf5(const char *name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -364,10 +363,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check args and all the boring stuff. */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* call the private is_HDF5 function */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ @@ -375,8 +370,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fis_hdf5() */ @@ -408,7 +401,6 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /* file struct for new file */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -435,13 +427,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -465,8 +453,6 @@ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) done: if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -495,7 +481,6 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /* file struct for new file */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -515,13 +500,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if((flags & H5F_ACC_SWMR_READ) && (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "SWMR read access on a file open for read-write access is not allowed") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the file */ if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) @@ -538,8 +519,6 @@ done: if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -559,7 +538,6 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) { H5F_t *f = NULL; /* File to flush */ H5O_loc_t *oloc = NULL; /* Object location for ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -645,13 +623,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush the file */ if(H5F__flush(f, scope) < 0) @@ -659,8 +633,6 @@ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fflush() */ @@ -682,7 +654,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Fclose(hid_t file_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -692,18 +663,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5I_FILE != H5I_get_type(file_id)) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Close the file */ if(H5F__close(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fclose() */ @@ -823,7 +787,6 @@ H5Fget_freespace(hid_t file_id) { H5F_t *file; /* File object for file ID */ hsize_t tot_space; /* Amount of free space in the file */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -833,11 +796,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the free space in the file */ if(H5F__get_freespace(file, &tot_space) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") @@ -845,8 +803,6 @@ api_ctx_pushed = TRUE; ret_value = (hssize_t)tot_space; done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fget_freespace() */ @@ -932,7 +888,6 @@ ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { H5F_t *file; /* File object for file ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -942,19 +897,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* call private get_file_image function */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Fget_file_image() */ @@ -1225,7 +1173,6 @@ herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) { H5F_t *f; /* Top file in mount hierarchy */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1253,18 +1200,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ } /* end else */ HDassert(f->shared); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the file info */ if(H5F__get_info(f, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fget_info2() */ @@ -1380,7 +1320,6 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { H5F_t *file; /* Top file in mount hierarchy */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1392,18 +1331,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(sect_info && nsects == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the free-space section information in the file */ if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fget_free_sections() */ @@ -1423,7 +1355,6 @@ herr_t H5Fclear_elink_file_cache(hid_t file_id) { H5F_t *file; /* File */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1434,20 +1365,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* See if there's an EFC */ - if(file->shared->efc) { -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - + if(file->shared->efc) /* Release the EFC */ if(H5F__efc_release(file->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") - } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fclear_elink_file_cache() */ @@ -1488,7 +1411,6 @@ H5Fstart_swmr_write(hid_t file_id) H5F_t *file; /* File info */ hbool_t ci_load = FALSE; /* whether MDC ci load requested */ hbool_t ci_write = FALSE; /* whether MDC CI write requested */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1519,21 +1441,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(ci_load || ci_write ) HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and MDC cache image") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(file_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(file_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call the internal routine */ if(H5F__start_swmr_write(file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fstart_swmr_write() */ @@ -1649,7 +1565,6 @@ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { H5F_t *f; /* File */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1659,21 +1574,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(file_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(file_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal set_libver_bounds function */ if(H5F__set_libver_bounds(f, low, high) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fset_libver_bounds() */ @@ -1692,7 +1601,6 @@ herr_t H5Fformat_convert(hid_t fid) { H5F_t *f; /* File to flush */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1705,21 +1613,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (f = (H5F_t *)H5I_object(fid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(fid, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(fid, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call the internal routine */ if(H5F__format_convert(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fformat_convert() */ @@ -1024,7 +1024,6 @@ H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/) haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ haddr_t ret_value = HADDR_UNDEF; FUNC_ENTER_API(HADDR_UNDEF) @@ -1042,12 +1041,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, HADDR_UNDEF, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Do the real work */ if(HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) @@ -1057,8 +1053,6 @@ H5CX_set_dxpl(dxpl_id); ret_value += file->base_addr; done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, HADDR_UNDEF, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDalloc() */ @@ -1082,7 +1076,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1098,12 +1091,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Do the real work */ /* (Note compensating for base address addition in internal routine) */ @@ -1111,8 +1101,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDfree() */ @@ -1378,7 +1366,6 @@ herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1397,12 +1384,8 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null result buffer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Do the real work */ /* (Note compensating for base address addition in internal routine) */ @@ -1410,8 +1393,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDread() */ @@ -1434,7 +1415,6 @@ herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1452,12 +1432,8 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null buffer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* The real work */ /* (Note compensating for base address addition in internal routine) */ @@ -1465,8 +1441,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDwrite() */ @@ -1489,7 +1463,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1503,20 +1476,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Do the real work */ if(H5FD_flush(file, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDflush() */ @@ -1562,7 +1530,6 @@ done: herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1576,20 +1543,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Do the real work */ if(H5FD_truncate(file, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5FDtruncate() */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 74507f0..6417956 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -102,7 +102,6 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) { H5F_t *f; /* Top file in mount hierarchy */ H5F_info2_t finfo2; /* Current file info struct */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -130,11 +129,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ } /* end else */ HDassert(f->shared); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the current file info */ if(H5F__get_info(f, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") @@ -145,8 +139,6 @@ api_ctx_pushed = TRUE; finfo->sohm.msgs_info = finfo2.sohm.msgs_info; done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Fget_info1() */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index a8228d8..eede84c 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -443,7 +443,6 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) { H5G_loc_t loc; H5F_t *child = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -462,22 +461,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Do the mount */ if(H5F__mount(&loc, name, child, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") - FUNC_LEAVE_API(ret_value) } /* end H5Fmount() */ @@ -505,7 +497,6 @@ herr_t H5Funmount(hid_t loc_id, const char *name) { H5G_loc_t loc; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -517,22 +508,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Unmount */ if(H5F__unmount(&loc, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") - FUNC_LEAVE_API(ret_value) } /* end H5Funmount() */ diff --git a/src/H5Ftest.c b/src/H5Ftest.c index df062ff..bdecad2 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -99,7 +99,7 @@ H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count) { H5F_t *file; /* File info */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -107,17 +107,20 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Retrieve count for message type */ if(H5SM__get_mesg_count_test(file, type_id, mesg_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_sohm_mesg_count_test() */ @@ -142,7 +145,7 @@ herr_t H5F_check_cached_stab_test(hid_t file_id) { H5F_t *file; /* File info */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -150,17 +153,20 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check arguments */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Verify the cached stab info */ if(H5G__verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to verify cached symbol table info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_check_cached_stab_test() */ @@ -289,7 +289,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -315,13 +314,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) @@ -334,8 +329,6 @@ done: if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate2() */ @@ -381,7 +374,6 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_loc_t loc; H5G_t *grp = NULL; H5G_obj_create_t gcrt_info; /* Information for group creation */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; FUNC_ENTER_API(H5I_INVALID_HID) @@ -398,13 +390,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -436,8 +424,6 @@ done: if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate_anon() */ @@ -464,7 +450,6 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -476,13 +461,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the group */ if(NULL == (grp = H5G__open_name(&loc, name))) @@ -497,8 +478,6 @@ done: if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gopen2() */ @@ -523,7 +502,6 @@ hid_t H5Gget_create_plist(hid_t group_id) { H5G_t *group = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -533,17 +511,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - if((ret_value = H5G__get_create_plist(group)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_create_plist() */ @@ -566,7 +537,6 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) { H5I_type_t id_type; /* Type of ID */ H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -583,18 +553,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(grp_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Retrieve the group's information */ if(H5G__get_info(&loc, grp_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_info() */ @@ -617,7 +580,6 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -631,21 +593,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ if(H5G__get_info_by_name(&loc, name, grp_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_info_by_name() */ @@ -669,7 +625,6 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -688,21 +643,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the group's information */ if(H5G__get_info_by_idx(&loc, group_name, idx_type, order, n, grp_info/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_info_by_idx() */ @@ -723,7 +672,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Gclose(hid_t group_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -732,10 +680,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check args */ if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* * Decrement the counter on the group atom. It will be freed if the count @@ -745,8 +689,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ @@ -767,7 +709,6 @@ herr_t H5Gflush(hid_t group_id) { H5G_t *grp; /* Group for this operation */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -777,21 +718,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(group_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(group_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ if(H5G__flush(grp, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Gflush */ @@ -812,7 +747,6 @@ herr_t H5Grefresh(hid_t group_id) { H5G_t *grp; /* Group for this operation */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -822,21 +756,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(group_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(group_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call private function to refresh group object */ if((H5G__refresh(grp, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Grefresh */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 5835e06..8d1441f 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -190,7 +190,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ hid_t tmp_gcpl = (-1); /* Temporary group creation property list */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -231,13 +230,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) @@ -253,8 +248,6 @@ done: if(ret_value < 0) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ @@ -282,7 +275,6 @@ H5Gopen1(hid_t loc_id, const char *name) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -294,11 +286,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open the group */ if(NULL == (grp = H5G__open_name(&loc, name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") @@ -311,8 +298,6 @@ done: if(ret_value < 0) if(grp && H5G_close(grp) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -329,7 +314,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -341,21 +325,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(cur_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(cur_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine to create link */ if(H5G__link(cur_loc_id, cur_name, type, H5L_SAME_LOC, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Glink() */ @@ -372,7 +350,6 @@ herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -384,21 +361,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!new_name || !*new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(cur_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(cur_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine to create link */ if(H5G__link(cur_loc_id, cur_name, type, new_loc_id, new_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "couldn't create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Glink2() */ @@ -484,27 +455,20 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(src_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(src_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call common routine to move the link */ if(H5G__move(src_loc_id, src_name, H5L_SAME_LOC, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gmove() */ @@ -520,7 +484,6 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -530,21 +493,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(dst_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(dst_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call common routine to move the link */ if(H5G__move(src_loc_id, src_name, dst_loc_id, dst_name, H5P_LINK_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gmove2() */ @@ -614,7 +571,6 @@ herr_t H5Gunlink(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -626,21 +582,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine */ if(H5G__unlink(&loc, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gunlink() */ @@ -688,7 +638,6 @@ herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -700,21 +649,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine */ if(H5G__get_linkval(&loc, name, size, buf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_linkval() */ @@ -772,7 +715,6 @@ herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -783,21 +725,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine */ if(H5G__set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gset_comment() */ @@ -860,7 +796,6 @@ int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -873,21 +808,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(bufsize > 0 && !buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine */ if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_comment() */ @@ -955,7 +884,6 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -977,11 +905,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call private function. */ if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") @@ -991,8 +914,6 @@ api_ctx_pushed = TRUE; *idx_p = (int)last_obj; done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ @@ -1051,7 +972,6 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { H5G_loc_t loc; /* Location of object */ H5G_info_t grp_info; /* Group information */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -1063,11 +983,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!num_objs) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call the internal routine */ if(H5G__get_num_objs(loc.oloc, &grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") @@ -1076,8 +991,6 @@ api_ctx_pushed = TRUE; *num_objs = grp_info.nlinks; done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_num_objs() */ @@ -1142,7 +1055,6 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1154,18 +1066,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_objinfo() */ @@ -1346,7 +1251,6 @@ ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; FUNC_ENTER_API(FAIL) @@ -1356,18 +1260,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call internal function */ if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_objname_by_idx() */ @@ -1430,7 +1327,6 @@ H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ H5G_obj_t ret_value; FUNC_ENTER_API(H5G_UNKNOWN) @@ -1440,18 +1336,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5G_UNKNOWN, "can't set API context") -api_ctx_pushed = TRUE; - /* Call internal function*/ if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, H5G_UNKNOWN, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Gget_objtype_by_idx() */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index eaee737..f2f3e3a 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -96,7 +96,7 @@ H5G__is_empty_test(hid_t gid) H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = FALSE; /* Indicate that a header message is present */ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -105,10 +105,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* "New format" checks */ @@ -185,8 +185,8 @@ api_ctx_pushed = TRUE; } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__is_empty_test() */ @@ -216,7 +216,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -225,10 +225,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) @@ -253,8 +253,8 @@ api_ctx_pushed = TRUE; } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__has_links_test() */ @@ -283,7 +283,7 @@ H5G__has_stab_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -292,10 +292,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) @@ -310,8 +310,8 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__has_stab_test() */ @@ -342,7 +342,7 @@ H5G__is_new_dense_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -351,10 +351,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) @@ -386,8 +386,8 @@ api_ctx_pushed = TRUE; } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__is_new_dense_test() */ @@ -421,7 +421,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_linfo_t linfo; /* Link info message */ H5G_t *grp = NULL; /* Pointer to group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -430,10 +430,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Set metadata tag in API context */ H5_BEGIN_TAG(grp->oloc.addr); @@ -478,8 +478,8 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(bt2_corder && H5B2_close(bt2_corder) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__new_dense_info_test() */ @@ -509,7 +509,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) { H5G_t *grp = NULL; /* Pointer to group */ H5O_stab_t stab; /* Symbol table message */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -518,10 +518,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Make certain the group has a symbol table message */ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) @@ -532,8 +532,8 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__lheap_size_test() */ @@ -566,7 +566,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign { void *obj_ptr; /* Pointer to object for ID */ H5G_name_t *obj_path; /* Pointer to group hier. path for obj */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -579,10 +579,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (obj_ptr = H5I_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the symbol table entry */ switch(H5I_get_type(obj_id)) { @@ -640,8 +640,8 @@ api_ctx_pushed = TRUE; } /* end else */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5G__user_path_test() */ @@ -1201,7 +1201,6 @@ done: int H5Idec_ref(hid_t id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ int ret_value = 0; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1210,18 +1209,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check arguments */ if(id < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Do actual decrement operation */ if((ret_value = H5I_dec_app_ref(id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ @@ -2025,7 +2018,6 @@ ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2035,18 +2027,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call internal routine to retrieve object's name */ if((ret_value = H5I__get_name(&loc, name, size)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ diff --git a/src/H5Itest.c b/src/H5Itest.c index 87aa7b9..426c026 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -79,7 +79,7 @@ ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -88,18 +88,18 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_name_test() */ @@ -304,7 +304,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -325,14 +324,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, - ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Set up src & dst location pointers */ src_loc_p = &src_loc; @@ -347,8 +342,6 @@ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ @@ -373,7 +366,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -394,14 +386,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, - ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Set up src & dst location pointers */ src_loc_p = &src_loc; @@ -416,8 +404,6 @@ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ @@ -445,7 +431,6 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -461,21 +446,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ @@ -502,7 +481,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -523,13 +501,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Set up current & new location pointers */ cur_loc_p = &cur_loc; @@ -546,8 +520,6 @@ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_hard() */ @@ -581,7 +553,6 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -596,21 +567,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create external link */ if(H5L__create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ @@ -636,7 +601,6 @@ herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -648,21 +612,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Unlink */ if(H5L__delete(&loc, name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ @@ -691,7 +649,6 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -707,21 +664,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Delete the link */ if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ldelete_by_idx() */ @@ -750,7 +701,6 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -762,21 +712,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ if(H5L__get_val(&loc, name, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lget_val() */ @@ -805,7 +749,6 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -822,21 +765,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ if(H5L__get_val_by_idx(&loc, group_name, idx_type, order, n, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lget_val_by_idx() */ @@ -858,7 +795,6 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -870,21 +806,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Check for the existence of the link */ if((ret_value = H5L__exists(&loc, name)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lexists() */ @@ -908,7 +838,6 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -920,21 +849,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ if(H5L__get_info(&loc, name, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ @@ -959,7 +882,6 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; /* Group location for group to query */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -976,21 +898,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ @@ -1149,7 +1065,6 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, char *name /*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1166,21 +1081,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lget_name_by_idx() */ @@ -1208,7 +1117,6 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data) { H5I_type_t id_type; /* Type of ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1225,18 +1133,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Iterate over the links */ if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ @@ -1268,7 +1169,6 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data, hid_t lapl_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1285,21 +1185,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Iterate over the links */ if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Literate_by_name() */ @@ -1337,7 +1231,6 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data) { H5I_type_t id_type; /* Type of ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1354,18 +1247,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call internal routine */ if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ @@ -1402,7 +1288,6 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1419,21 +1304,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lvisit_by_name() */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 73ca17c..7c32309 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -340,7 +340,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name, size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -375,13 +374,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create an external link */ if(H5L__create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id) < 0) @@ -391,8 +386,6 @@ done: H5MM_xfree(ext_link_buf); H5MM_xfree(norm_obj_name); -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_external() */ @@ -100,7 +100,6 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) @@ -112,21 +111,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ if((ret_value = H5O__open_name(&loc, name)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -159,7 +152,6 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) @@ -175,21 +167,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ if((ret_value = H5O__open_by_idx(&loc, group_name, idx_type, order, n)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_idx() */ @@ -233,7 +219,6 @@ hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { H5G_loc_t loc; /* Location within file */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) @@ -245,18 +230,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no address supplied") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open the object */ if((ret_value = H5O__open_by_addr(&loc, addr)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_addr() */ @@ -288,7 +266,6 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5G_loc_t new_loc; /* Location of group to link from */ H5G_loc_t obj_loc; /* Location of object to link to */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -311,21 +288,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Create a link to the object */ if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Olink() */ @@ -354,7 +325,6 @@ herr_t H5Oincr_refcount(hid_t object_id) { H5O_loc_t *oloc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -364,21 +334,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if((oloc = H5O_get_loc(object_id)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(object_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(object_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ if(H5O__link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5O_incr_refcount() */ @@ -407,7 +371,6 @@ herr_t H5Odecr_refcount(hid_t object_id) { H5O_loc_t *oloc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -417,21 +380,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if((oloc = H5O_get_loc(object_id)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(object_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(object_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ if(H5O__link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Odecr_refcount() */ @@ -453,7 +410,6 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -465,21 +421,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Check if the object exists */ if((ret_value = H5O__exists_by_name(&loc, name)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oexists_by_name() */ @@ -501,7 +451,6 @@ herr_t H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -513,18 +462,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Retrieve the object's information */ if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oget_info() */ @@ -546,7 +488,6 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -560,21 +501,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ if(H5O__get_info_by_name(&loc, name, oinfo/*out*/) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_name() */ @@ -598,7 +533,6 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -617,21 +551,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx() */ @@ -657,7 +585,6 @@ herr_t H5Oset_comment(hid_t obj_id, const char *comment) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -667,21 +594,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(obj_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* (Re)set the object's comment */ if(H5O__set_comment_by_name(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment() */ @@ -708,7 +629,6 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -720,21 +640,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* (Re)set the object's comment */ if(H5O__set_comment_by_name(&loc, name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment_by_name() */ @@ -759,7 +673,6 @@ ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -769,18 +682,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Retrieve the object's comment */ if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment() */ @@ -806,7 +712,6 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -818,21 +723,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's comment */ if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment_by_name() */ @@ -873,7 +772,6 @@ herr_t H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -887,18 +785,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Call internal object visitation routine */ if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ovisit() */ @@ -939,7 +830,6 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -956,21 +846,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal object visitation routine */ if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name() */ @@ -996,7 +880,6 @@ if(api_ctx_pushed && H5CX_pop() < 0) herr_t H5Oclose(hid_t object_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -1009,10 +892,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; @@ -1036,8 +915,6 @@ api_ctx_pushed = TRUE; } /* end switch */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oclose() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 3ca5540..b5a3bdf 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -208,7 +208,6 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t loc; /* Source group group location */ H5G_loc_t dst_loc; /* Destination group location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -225,21 +224,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!dst_name || !*dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(src_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(src_loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call internal routine to copy object */ if(H5O__copy(&loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Ocopy() */ diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 31ef9b9..65cb2ae 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -73,27 +73,20 @@ static herr_t H5O__refresh(hid_t obj_id); herr_t H5Oflush(hid_t obj_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", obj_id); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(obj_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ if(H5O__flush(obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Oflush() */ @@ -242,27 +235,20 @@ done: herr_t H5Orefresh(hid_t oid) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(oid, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(oid, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ if(H5O__refresh(oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Orefresh() */ diff --git a/src/H5Otest.c b/src/H5Otest.c index c978d10..32b31f2 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -98,7 +98,7 @@ H5O_is_attr_dense_test(hid_t oid) H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5O_loc_t *loc; /* Pointer to object's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -107,10 +107,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -137,8 +137,8 @@ api_ctx_pushed = TRUE; done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_dense_test() */ @@ -171,7 +171,7 @@ H5O_is_attr_empty_test(hid_t oid) htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ H5O_loc_t *loc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -180,10 +180,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -238,8 +238,8 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_empty_test() */ @@ -272,7 +272,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) H5O_ainfo_t ainfo; /* Attribute information for object */ H5O_loc_t *loc; /* Pointer to object's location */ hsize_t obj_nattrs; /* Number of attributes */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -281,10 +281,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -336,8 +336,8 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_num_attrs_test() */ @@ -372,7 +372,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5O_loc_t *loc; /* Pointer to object's location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -381,10 +381,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Set metadata tag in API context */ H5_BEGIN_TAG(loc->addr); @@ -439,8 +439,8 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_attr_dense_info_test() */ @@ -642,7 +642,7 @@ H5O_msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) H5O_loc_t *loc; /* Pointer to object's location */ H5O_mesg_t *idx_msg; /* Pointer to message */ unsigned idx; /* Index of message */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -651,10 +651,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) @@ -677,8 +677,8 @@ api_ctx_pushed = TRUE; done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_msg_get_chunkno_test() */ @@ -710,7 +710,7 @@ H5O_msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) H5O_loc_t *loc; /* Pointer to object's location */ H5O_mesg_t *curr_msg; /* Pointer to current message */ unsigned idx; /* Index of message */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -719,10 +719,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; + /* Set API context */ + if(H5CX_push() < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + api_ctx_pushed = TRUE; /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) @@ -785,8 +785,8 @@ api_ctx_pushed = TRUE; done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + if(api_ctx_pushed && H5CX_pop() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_msg_get_chunkno_test() */ @@ -97,7 +97,6 @@ hid_t H5Pcopy(hid_t id) { void *obj; /* Property object to copy */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value=FALSE; /* return value */ FUNC_ENTER_API(FAIL) @@ -111,10 +110,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property object"); if(NULL == (obj = H5I_object(id))) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Compare property lists */ if(H5I_GENPROP_LST == H5I_get_type(id)) { @@ -137,8 +132,6 @@ api_ctx_pushed = TRUE; } /* end else */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Pcopy() */ @@ -1509,7 +1502,6 @@ done: herr_t H5Pclose(hid_t plist_id) { -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -1520,10 +1512,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Check arguments. */ if(H5I_GENPROP_LST != H5I_get_type(plist_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Close the property list */ if(H5I_dec_app_ref(plist_id) < 0) @@ -1531,8 +1519,6 @@ api_ctx_pushed = TRUE; } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Pclose() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 2629aa7..e2c92cd 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -3185,7 +3185,6 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) { H5P_genplist_t *plist; /* Property list pointer */ H5O_fill_t fill; /* Fill value to modify */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -3194,10 +3193,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Get the current fill value */ if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) @@ -3254,8 +3249,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Pset_fill_value() */ @@ -3375,7 +3368,6 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ H5T_t *type; /* Datatype */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -3390,18 +3382,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Get the fill value */ if(H5P_get_fill_value(plist, type, value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Pget_fill_value() */ @@ -93,7 +93,6 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5G_loc_t loc; /* File location */ H5S_t *space = NULL; /* Pointer to dataspace containing region */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -115,21 +114,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (space_id != (-1) && (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Create reference */ if((ret_value = H5R__create(ref, &loc, name, ref_type, space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rcreate() */ @@ -166,7 +159,6 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r { H5G_loc_t loc; /* Group location */ H5F_t *file = NULL; /* File object */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -182,13 +174,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the file pointer from the entry */ file = loc.oloc->file; @@ -198,8 +186,6 @@ if(H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rdereference2() */ @@ -232,7 +218,6 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) { H5G_loc_t loc; /* Object's group location */ H5S_t *space = NULL; /* Dataspace object */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -246,11 +231,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the dataspace with the correct region selected */ if(NULL == (space = H5R__get_region(loc.oloc->file, ref))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") @@ -260,8 +240,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace atom") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rget_region() */ @@ -294,7 +272,6 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type) { H5G_loc_t loc; /* Object location */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -308,18 +285,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the object information */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rget_obj_type2() */ @@ -363,7 +333,6 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5G_loc_t loc; /* Group location */ H5F_t *file; /* File object */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -377,11 +346,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the file pointer from the entry */ file = loc.oloc->file; @@ -390,8 +354,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rget_name() */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index ccb4798..2f41f7d 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -104,7 +104,6 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { H5G_loc_t loc; /* Object location */ H5O_type_t obj_type; /* Object type */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) @@ -118,11 +117,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5G_UNKNOWN, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the object information */ if(H5R__get_obj_type(loc.oloc->file, ref_type, ref, &obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") @@ -131,8 +125,6 @@ api_ctx_pushed = TRUE; ret_value = H5G_map_obj_type(obj_type); done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5G_UNKNOWN, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rget_obj_type1() */ @@ -158,7 +150,6 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) { H5G_loc_t loc; /* Group location */ H5F_t *file = NULL; /* File object */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -172,11 +163,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if (_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Get the file pointer from the entry */ file = loc.oloc->file; @@ -185,8 +171,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, "unable dereference object") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Rdereference1() */ @@ -1744,7 +1744,6 @@ herr_t H5Tclose(hid_t type_id) { H5T_t *dt; /* Pointer to datatype to close */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1755,18 +1754,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(H5T_STATE_IMMUTABLE == dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* When the reference count reaches zero the resources are freed */ if(H5I_dec_app_ref(type_id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tclose() */ @@ -2526,7 +2519,6 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_t *src; /*source data type descriptor */ H5T_t *dst; /*destination data type desc */ H5T_conv_func_t conv_func; /* Conversion function wrapper */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_API(FAIL) @@ -2543,10 +2535,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if(!func) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; /* Set up conversion function wrapper */ conv_func.is_app = TRUE; @@ -2557,8 +2545,6 @@ api_ctx_pushed = TRUE; HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tregister() */ @@ -2688,7 +2674,6 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_conv_t func) { H5T_t *src = NULL, *dst = NULL; /* Datatype descriptors */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2699,17 +2684,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src is not a data type") if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; if(H5T__unregister(pers, name, src, dst, func) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tunregister() */ @@ -2833,7 +2812,6 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, { H5T_path_t *tpath; /* type conversion info */ H5T_t *src, *dst; /* unatomized types */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -2848,12 +2826,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ else if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set DXPL for operation */ -H5CX_set_dxpl(dxpl_id); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); /* Find the conversion function */ if(NULL == (tpath = H5T_path_find(src, dst))) @@ -2863,8 +2838,6 @@ H5CX_set_dxpl(dxpl_id); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tconvert() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 91a0f1c..12492fd 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -103,7 +103,6 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -131,21 +130,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -254,7 +247,6 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ H5T_t *type = NULL; /* Datatype created */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -273,21 +265,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Commit the type */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tcommit_anon() */ @@ -568,7 +554,6 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { H5T_t *type = NULL; /* Datatype opened in file */ H5G_loc_t loc; /* Group location of object to open */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -580,13 +565,9 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Verify access property list and set up collective metadata if appropriate */ -if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Open it */ if(NULL == (type = H5T__open_name(&loc, name))) @@ -602,8 +583,6 @@ done: if(type != NULL) (void)H5T_close(type); -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ @@ -632,7 +611,6 @@ H5Tget_create_plist(hid_t dtype_id) { H5T_t *type; /* Datatype object for ID */ herr_t status; /* Generic status value */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -647,20 +625,12 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed") /* Retrieve further information, if the datatype is committed */ - if(status > 0) { -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - + if(status > 0) /* Retrieve datatype creation properties */ if((ret_value = H5T__get_create_plist(type)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") - } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tget_create_plist() */ @@ -681,7 +651,6 @@ herr_t H5Tflush(hid_t type_id) { H5T_t *dt; /* Datatype for this operation */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -693,21 +662,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!H5T_is_named(dt)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(type_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(type_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ if(H5T__flush(dt, type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Tflush */ @@ -728,7 +691,6 @@ herr_t H5Trefresh(hid_t type_id) { H5T_t *dt; /* Datatype for this operation */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -740,21 +702,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!H5T_is_named(dt)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(type_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(type_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call private function to refresh datatype object */ if((H5T__refresh(dt, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* H5Trefresh */ diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 3daf365..feece57 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -214,7 +214,6 @@ H5Tget_member_type(hid_t type_id, unsigned membno) { H5T_t *dt; /* Datatype to query */ H5T_t *memb_dt = NULL; /* Member datatype */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -226,11 +225,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Retrieve the datatype for the member */ if(NULL == (memb_dt = H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") @@ -243,8 +237,6 @@ done: if(ret_value < 0) if(memb_dt && H5T_close(memb_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tget_member_type() */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 5a273f5..e4224f5 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -102,7 +102,6 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -116,21 +115,15 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; -/* Set up collective metadata if appropriate */ -if(H5CX_set_loc(loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Commit the datatype to the file, using default property list values */ if(H5T__commit_named(&loc, name, type, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tcommit1() */ @@ -156,7 +149,6 @@ H5Topen1(hid_t loc_id, const char *name) { H5T_t *type = NULL; H5G_loc_t loc; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -168,11 +160,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; - /* Open it */ if(NULL == (type = H5T__open_name(&loc, name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") @@ -186,8 +173,6 @@ done: if(ret_value < 0) if(type && H5T_close(type) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 546b487..c9ad01a 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -78,7 +78,6 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) H5T_t *dt; /* Datatype to create native datatype from */ H5T_t *new_dt = NULL; /* Datatype for native datatype created */ size_t comp_size = 0; /* Compound datatype's size */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -90,10 +89,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(direction != H5T_DIR_DEFAULT && direction != H5T_DIR_ASCEND && direction != H5T_DIR_DESCEND) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not valid direction value") -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set API context") -api_ctx_pushed = TRUE; /* Get the native type */ if(NULL == (new_dt = H5T__get_native_type(dt, direction, NULL, NULL, &comp_size))) @@ -108,8 +103,6 @@ done: if(ret_value < 0) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset API context") FUNC_LEAVE_API(ret_value) } /* end H5Tget_native_type() */ @@ -581,7 +581,6 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ H5Z_object_t *object = (H5Z_object_t *)key; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC @@ -593,11 +592,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Do a global flush if the file is opened for write */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { -/* Set API context */ -if(H5CX_push() < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set API context") -api_ctx_pushed = TRUE; - /* When parallel HDF5 is defined, check for collective metadata reads on this * file and set the flag for metadata I/O in the API context. -QAK, 2018/02/14 */ @@ -636,15 +630,9 @@ api_ctx_pushed = TRUE; /* Call the flush routine for mounted file hierarchies */ if(H5F_flush_mounts((H5F_t *)obj_ptr) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") - -if(api_ctx_pushed && H5CX_pop() < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTRESET, FAIL, "can't reset API context") -api_ctx_pushed = FALSE; } /* end if */ done: -if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTRESET, FAIL, "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__flush_file_cb() */ diff --git a/test/accum.c b/test/accum.c index 76e7656..19006b6 100644 --- a/test/accum.c +++ b/test/accum.c @@ -88,7 +88,7 @@ int main(void) { unsigned nerrors = 0; /* track errors */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; H5F_t * f = NULL; /* File for all tests */ @@ -98,8 +98,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create a test file */ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR @@ -124,8 +126,10 @@ api_ctx_pushed = TRUE; nerrors += test_free(f); nerrors += test_big(f); nerrors += test_random_write(f); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; /* End of test code, close and delete file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -142,7 +146,8 @@ api_ctx_pushed = FALSE; return 0; error: -if(api_ctx_pushed) H5CX_pop(); + if(api_ctx_pushed) H5CX_pop(); + puts("*** TESTS FAILED ***"); return 1; } /* end main() */ @@ -1822,7 +1827,7 @@ test_swmr_write_big(hbool_t newest_format) int status; /* Status returned from child process */ char *new_argv[] = {NULL}; char *driver = NULL; /* VFD string (from env variable) */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if(newest_format) TESTING("SWMR write of large metadata: with latest format") @@ -1870,8 +1875,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Open the file with SWMR_WRITE */ if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ if(NULL == (rf = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR @@ -1957,19 +1964,22 @@ api_ctx_pushed = TRUE; /* Check if child process terminates normally and its return value */ if(WIFEXITED(status) && !WEXITSTATUS(status)) { - /* Flush the accumulator */ - if(accum_reset(rf) < 0) - FAIL_STACK_ERROR; - /* Close the property list */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; - - /* Close and remove the file */ - if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; - HDremove(SWMR_FILENAME); + /* Flush the accumulator */ + if(accum_reset(rf) < 0) + FAIL_STACK_ERROR; + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + + /* Close and remove the file */ + if(H5Fclose(fid) < 0) + FAIL_STACK_ERROR; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + + HDremove(SWMR_FILENAME); /* Release memory */ if(wbuf2) @@ -1984,8 +1994,11 @@ error: /* Closing and remove the file */ H5Pclose(fapl); H5Fclose(fid); -if(api_ctx_pushed) H5CX_pop(); + + if(api_ctx_pushed) H5CX_pop(); + HDremove(SWMR_FILENAME); + /* Release memory */ if(wbuf2) HDfree(wbuf2); diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 9005b99..5bda46a 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -50,7 +50,7 @@ main(void) uint8_t rbuf[1024]; /* Buffer for reading */ uint8_t buf[1024]; /* Buffer for holding the expected data */ char *driver = NULL; /* VFD string (from env variable) */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -72,8 +72,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Open the file with SWMR_READ */ if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Get H5F_t * to internal file structure */ if(NULL == (f = (H5F_t *)H5I_object(fid))) @@ -92,14 +94,18 @@ api_ctx_pushed = TRUE; FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; return EXIT_SUCCESS; error: H5Fclose(fid); -if(api_ctx_pushed) H5CX_pop(); + + if(api_ctx_pushed) H5CX_pop(); + return EXIT_FAILURE; } /* end main() */ diff --git a/test/btree2.c b/test/btree2.c index fb0156c..e2874b7 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -9947,7 +9947,7 @@ main(void) unsigned reopen; /* Whether to reopen B-tree during tests */ int ExpressMode; const char *envval = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) @@ -9962,8 +9962,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Initialize v2 B-tree creation parameters */ init_cparam(&cparam, &cparam2); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Loop over re-opening B-tree during tests */ for(reopen = FALSE; reopen <= TRUE; reopen++) { @@ -10052,8 +10054,10 @@ api_ctx_pushed = TRUE; /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -10071,6 +10075,8 @@ error: H5Pclose(fapl); } H5E_END_TRY; + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ diff --git a/test/cache_common.c b/test/cache_common.c index 78e2253..5596601 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3267,7 +3267,9 @@ setup_cache(size_t max_cache_size, HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC); } /* end if */ } /* end if */ -H5CX_push(); + + /* Push API context */ + H5CX_push(); if(show_progress) /* 4 */ HDfprintf(stdout, "%s() - %0d -- pass = %d\n", @@ -3497,7 +3499,9 @@ takedown_cache(H5F_t * file_ptr, saved_fid = -1; } -H5CX_pop(); + + /* Pop API context */ + H5CX_pop(); if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 15ce6c2..7a2bb49 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3638,7 +3638,7 @@ check_invalid_tag_application(void) hid_t fid = -1; haddr_t addr; H5HL_t * lheap = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ /* Testing Macro */ @@ -3647,8 +3647,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ #if H5C_DO_TAGGING_SANITY_CHECKS /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; -if(H5CX_push() < 0) TEST_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) TEST_ERROR + api_ctx_pushed = TRUE; /* Get internal file pointer*/ if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; @@ -3678,8 +3680,10 @@ api_ctx_pushed = TRUE; /* Now unprotect the heap, as we're done with the test. */ if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) TEST_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) TEST_ERROR + api_ctx_pushed = FALSE; /* Close open objects and file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; @@ -3695,7 +3699,7 @@ api_ctx_pushed = FALSE; error: #if H5C_DO_TAGGING_SANITY_CHECKS -if(api_ctx_pushed) H5CX_pop(); + if(api_ctx_pushed) H5CX_pop(); #endif /* H5C_DO_TAGGING_SANITY_CHECKS */ return 1; diff --git a/test/dsets.c b/test/dsets.c index 0e0b9d9..ca1e3d5 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -28,6 +28,7 @@ #include "H5srcdir.h" #include "H5Bprivate.h" +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5Pprivate.h" @@ -2533,6 +2534,7 @@ test_missing_filter(hid_t file) size_t i,j; /* Local index variables */ herr_t ret; /* Generic return value */ const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("dataset access with missing filter"); @@ -2545,6 +2547,10 @@ test_missing_filter(hid_t file) goto error; } /* end if */ + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; + /* Unregister deflate filter */ /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { @@ -2740,10 +2746,16 @@ test_missing_filter(hid_t file) } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + PASSED(); return 0; error: + if(api_ctx_pushed) H5CX_pop(); + return -1; } diff --git a/test/earray.c b/test/earray.c index 0605605..d72b3f5 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2429,7 +2429,7 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ time_t curr_time; /* Current time, for seeding random number generator */ int ExpressMode; /* Test express value */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Reset library */ h5_reset(); @@ -2440,8 +2440,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Seed random #'s */ curr_time = HDtime(NULL); @@ -2588,8 +2590,10 @@ api_ctx_pushed = TRUE; /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -2607,6 +2611,8 @@ error: H5Pclose(fapl); } H5E_END_TRY; + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ @@ -2891,7 +2891,7 @@ int main(void) { unsigned nerrors = 0; /* track errors */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ puts("Testing the external file cache"); @@ -2907,8 +2907,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[3], fapl_id, filename[3], sizeof(filename[3])); h5_fixname(FILENAME[4], fapl_id, filename[4], sizeof(filename[4])); h5_fixname(FILENAME[5], fapl_id, filename[5], sizeof(filename[5])); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Test Functions */ nerrors += test_single(); @@ -2921,8 +2923,10 @@ api_ctx_pushed = TRUE; /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -2940,6 +2944,8 @@ error: H5Pclose(fapl_id); } H5E_END_TRY + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ diff --git a/test/farray.c b/test/farray.c index 5ff950e..383cb32 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1659,7 +1659,7 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ time_t curr_time; /* Current time, for seeding random number generator */ int ExpressMode; /* Test express value */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Reset library */ h5_reset(); @@ -1670,8 +1670,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Seed random #'s */ curr_time = HDtime(NULL); @@ -1791,8 +1793,10 @@ api_ctx_pushed = TRUE; /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -1810,6 +1814,8 @@ error: H5Pclose(fapl); } H5E_END_TRY; + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ diff --git a/test/fheap.c b/test/fheap.c index 3a4fea3..e38d263 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16288,7 +16288,7 @@ main(void) int ExpressMode; /* Express testing level */ const char *envval; /* Environment variable */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Don't run this test using certain file drivers */ envval = HDgetenv("HDF5_DRIVER"); @@ -16327,8 +16327,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Initialize heap creation parameters */ init_small_cparam(&small_cparam); init_large_cparam(&large_cparam); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Allocate space for the shared objects */ shared_obj_size_g = large_cparam.max_man_size + 256; @@ -16777,8 +16779,6 @@ api_ctx_pushed = TRUE; /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -16794,6 +16794,10 @@ api_ctx_pushed = FALSE; if(H5Pclose(def_fcpl) < 0) TEST_ERROR if(H5Pclose(pb_fapl) < 0) TEST_ERROR + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + /* Clean up file used */ h5_cleanup(FILENAME, def_fapl); @@ -16812,6 +16816,9 @@ error: H5Pclose(def_fcpl); H5Pclose(fcpl); } H5E_END_TRY; + + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ diff --git a/test/freespace.c b/test/freespace.c index ebc7840..33a6f89 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -457,7 +457,6 @@ test_fs_create(hid_t fapl) H5FS_create_t cparam, test_cparam; /* creation parameters */ uint16_t nclasses; unsigned init_flags=0; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("the creation/close/reopen/deletion of the free-space manager"); @@ -479,8 +478,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -548,8 +545,6 @@ api_ctx_pushed = TRUE; /* Verify the file is the correct size */ if(file_size != empty_size) TEST_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -560,7 +555,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_fs_create() */ @@ -606,7 +600,6 @@ test_fs_sect_add(hid_t fapl) unsigned init_flags=0; h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0; unsigned can_shrink=FALSE; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("adding a section via H5FS_sect_add() to free-space: test 1"); @@ -627,8 +620,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -891,8 +882,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -905,7 +894,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_fs_sect_add() */ @@ -947,7 +935,6 @@ test_fs_sect_find(hid_t fapl) TEST_free_section_t *node; htri_t node_found = FALSE; unsigned init_flags=0; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("H5FS_sect_find(): free-space is empty"); @@ -957,8 +944,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -1266,8 +1251,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -1284,7 +1267,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_fs_sect_find() */ @@ -1338,7 +1320,6 @@ test_fs_sect_merge(hid_t fapl) unsigned init_flags=0; htri_t node_found = FALSE; TEST_free_section_t *node; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("the merge of sections when H5FS_sect_add() to free-space: test 1"); @@ -1351,8 +1332,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -1742,8 +1721,6 @@ api_ctx_pushed = TRUE; /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -1758,7 +1735,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_fs_sect_merge() */ @@ -1814,7 +1790,6 @@ test_fs_sect_shrink(hid_t fapl) unsigned can_shrink=FALSE; htri_t node_found = FALSE; TEST_free_section_t *node; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("shrinking of sections when H5FS_sect_add() to free-space: test 1"); @@ -1824,8 +1799,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -2112,8 +2085,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -2124,7 +2095,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_sect_shrink() */ @@ -2161,7 +2131,6 @@ test_fs_sect_change_class(hid_t fapl) TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL, *sect_node3=NULL; unsigned init_flags=0; TEST_free_section_t *node; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("the change of section class via H5FS_sect_change_class() in free-space: Test 1"); @@ -2171,8 +2140,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -2393,8 +2360,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -2409,7 +2374,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_sect_change_class() */ @@ -2459,7 +2423,6 @@ test_fs_sect_extend(hid_t fapl) TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL; unsigned init_flags=0; htri_t status; /* Status of 'try' calls */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("a block's extension by requested-size which is = adjoining free section's size: Test 1"); @@ -2468,8 +2431,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -2778,8 +2739,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; return 0; @@ -2788,7 +2747,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_sect_extend() */ @@ -2818,7 +2776,6 @@ test_fs_sect_iterate(hid_t fapl) TEST_iter_ud_t udata; int i; hsize_t tot_space, nsects; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("iteration of sections in the free-space manager"); @@ -2828,8 +2785,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -2886,8 +2841,6 @@ api_ctx_pushed = TRUE; /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED() @@ -2898,7 +2851,6 @@ error: if(frsp) H5FS_close(f, frsp); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return 1; } /* test_fs_sect_iterate() */ @@ -2910,6 +2862,7 @@ main(void) hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ const char *env_h5_drvr = NULL; /* File Driver value from environment */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -2923,6 +2876,10 @@ main(void) PUTS_ERROR("Can't get VFD-dependent fapl") } /* end if */ + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; + /* make sure alignment is not set for tests to succeed */ if(H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1) < 0) { nerrors++; @@ -2945,6 +2902,10 @@ main(void) goto error; HDputs("All free-space tests passed."); + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + h5_cleanup(FILENAME, fapl); HDexit(EXIT_SUCCESS); @@ -2953,6 +2914,9 @@ error: H5E_BEGIN_TRY { H5Pclose(fapl); } H5E_END_TRY; + + if(api_ctx_pushed) H5CX_pop(); + HDexit(EXIT_FAILURE); } /* main() */ diff --git a/test/gheap.c b/test/gheap.c index 716c34a..bf0f18a 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -87,7 +87,6 @@ test_1 (hid_t fapl) herr_t status; int nerrors = 0; char filename[1024]; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("monotonically increasing lengths"); @@ -99,8 +98,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); @@ -151,8 +148,6 @@ api_ctx_pushed = TRUE; obj = NULL; if(H5Fclose(file) < 0) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if(nerrors) goto error; PASSED(); @@ -161,7 +156,6 @@ api_ctx_pushed = FALSE; error: H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; if(obj) HDfree(obj); @@ -198,7 +192,6 @@ test_2 (hid_t fapl) size_t size; int nerrors = 0; char filename[1024]; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("monotonically decreasing lengths"); @@ -210,8 +203,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); @@ -255,8 +246,6 @@ api_ctx_pushed = TRUE; obj = NULL; if (H5Fclose(file)<0) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if (nerrors) goto error; PASSED(); @@ -265,7 +254,6 @@ api_ctx_pushed = FALSE; error: H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; if(obj) HDfree(obj); @@ -302,7 +290,6 @@ test_3 (hid_t fapl) herr_t status; int nerrors = 0; char filename[1024]; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("complete object removal"); @@ -314,8 +301,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); @@ -350,8 +335,6 @@ api_ctx_pushed = TRUE; obj = NULL; if (H5Fclose(file)<0) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if (nerrors) goto error; PASSED(); @@ -360,7 +343,6 @@ api_ctx_pushed = FALSE; error: H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; if(obj) HDfree(obj); @@ -398,7 +380,6 @@ test_4 (hid_t fapl) herr_t status; int nerrors = 0; char filename[1024]; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("partial object removal"); @@ -410,8 +391,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); @@ -452,8 +431,6 @@ api_ctx_pushed = TRUE; obj = NULL; if (H5Fclose(file)<0) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if (nerrors) goto error; PASSED(); @@ -462,7 +439,6 @@ api_ctx_pushed = FALSE; error: H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; if(obj) HDfree(obj); @@ -499,7 +475,6 @@ test_ooo_indices(hid_t fapl) herr_t status; int nerrors=0; char filename[1024]; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("out of order indices"); @@ -510,8 +485,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); puts(" Unable to create file"); @@ -571,8 +544,6 @@ api_ctx_pushed = TRUE; } /* end for */ if (H5Fclose(file)<0) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; if (nerrors) goto error; HDfree(obj); @@ -584,7 +555,6 @@ api_ctx_pushed = FALSE; error: H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; if(obj) HDfree(obj); @@ -613,10 +583,15 @@ main (void) { int nerrors=0; hid_t fapl; + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); fapl = h5_fileaccess(); + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; + nerrors += test_1(fapl); nerrors += test_2(fapl); nerrors += test_3(fapl); @@ -626,13 +601,22 @@ main (void) /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); - if (nerrors) goto error; - + if (nerrors) + goto error; puts("All global heap tests passed."); + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + h5_cleanup(FILENAME, fapl); return 0; error: puts("*** TESTS FAILED ***"); + + if(api_ctx_pushed) H5CX_pop(); + return 1; } + diff --git a/test/lheap.c b/test/lheap.c index dd8110e..4f09b6e 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -63,12 +63,15 @@ main(void) int i, j; /* miscellaneous counters */ char buf[1024]; /* the value to store */ const char *s; /* value to read */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Reset library */ h5_reset(); fapl = h5_fileaccess(); + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* * Test writing to the heap... @@ -77,8 +80,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); @@ -119,8 +120,6 @@ api_ctx_pushed = TRUE; } if (FAIL == H5Fclose(file)) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED(); /* @@ -131,8 +130,6 @@ api_ctx_pushed = FALSE; h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl))) goto error; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); @@ -179,8 +176,6 @@ api_ctx_pushed = TRUE; if (FAIL == H5Fclose(file)) goto error; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED(); /* Check opening existing file non-default sizes of lengths and addresses */ @@ -189,8 +184,6 @@ api_ctx_pushed = FALSE; const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ hid_t dset = -1; file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(file >= 0){ if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR @@ -206,13 +199,15 @@ api_ctx_pushed = TRUE; goto error; } /* end else */ } -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; PASSED(); /* Verify symbol table messages are cached */ if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); @@ -222,8 +217,10 @@ api_ctx_pushed = FALSE; HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; + + if(api_ctx_pushed) H5CX_pop(); + return 1; } @@ -8868,7 +8868,7 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ test_type_t curr_test; /* Current test being worked on */ const char *env_h5_drvr; /* File Driver value from environment */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -8878,8 +8878,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); fapl = h5_fileaccess(); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Make a copy of the FAPL before adjusting the alignment */ if((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR @@ -8993,8 +8995,10 @@ api_ctx_pushed = TRUE; if(H5Pclose(new_fapl) < 0) FAIL_STACK_ERROR h5_cleanup(FILENAME, fapl); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; if(nerrors) goto error; @@ -9007,8 +9011,10 @@ error: H5E_BEGIN_TRY { H5Pclose(fapl); H5Pclose(new_fapl); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; + + if(api_ctx_pushed) H5CX_pop(); + return(1); } /* main() */ diff --git a/test/ohdr.c b/test/ohdr.c index 5821357..d0f6966 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -69,7 +69,6 @@ test_cont(char *filename, hid_t fapl) const char *short_name = "T"; const char *long_name = "This is the message"; size_t nchunks; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("object header continuation block"); @@ -79,8 +78,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { @@ -145,11 +142,9 @@ api_ctx_pushed = TRUE; FAIL_STACK_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR PASSED(); - return SUCCEED; error: @@ -157,7 +152,6 @@ error: H5O_close(&oh_locA, NULL); H5O_close(&oh_locB, NULL); H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; return FAIL; @@ -808,7 +802,7 @@ main(void) time_t time_new, ro; char msg[80]; /* Message for file format version */ int i; /* Local index variable */ -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ /* Reset library */ @@ -816,6 +810,10 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; + /* Loop through all the combinations of low/high library format bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { @@ -846,8 +844,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) { @@ -1037,8 +1033,6 @@ api_ctx_pushed = TRUE; if(test_ohdr_cache(filename, fapl) < 0) TEST_ERROR -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; } /* high */ } /* low */ @@ -1049,6 +1043,10 @@ api_ctx_pushed = FALSE; if(test_ohdr_swmr(TRUE) < 0) TEST_ERROR if(test_ohdr_swmr(FALSE) < 0) TEST_ERROR + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + HDputs("All object header tests passed."); h5_cleanup(FILENAME, fapl); return 0; @@ -1057,9 +1055,10 @@ error: puts("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Fclose(file); -if(api_ctx_pushed) H5CX_pop(); } H5E_END_TRY; + if(api_ctx_pushed) H5CX_pop(); + return 1; } /* end main() */ diff --git a/test/page_buffer.c b/test/page_buffer.c index 9901304..a6e85ee 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -577,7 +577,6 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) haddr_t addr = HADDR_UNDEF; int *data = NULL; H5F_t *f = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("Raw Data Handling"); @@ -603,8 +602,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file_id))) @@ -797,8 +794,6 @@ api_ctx_pushed = TRUE; FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; HDfree(data); PASSED() @@ -809,7 +804,6 @@ error: H5Pclose(fapl); H5Pclose(fcpl); H5Fclose(file_id); -if(api_ctx_pushed) H5CX_pop(); if(data) HDfree(data); } H5E_END_TRY; @@ -862,7 +856,6 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) haddr_t search_addr = HADDR_UNDEF; int *data = NULL; H5F_t *f = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("LRU Processing"); @@ -896,8 +889,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file_id))) FAIL_STACK_ERROR; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* opening the file inserts one or more pages into the page buffer. * Get the number of pages inserted, and verify that it is the @@ -1056,8 +1047,6 @@ api_ctx_pushed = TRUE; FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; HDfree(data); PASSED() @@ -1068,7 +1057,6 @@ error: H5Pclose(fapl); H5Pclose(fcpl); H5Fclose(file_id); -if(api_ctx_pushed) H5CX_pop(); if(data) HDfree(data); } H5E_END_TRY; @@ -1124,7 +1112,6 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) haddr_t raw_addr = HADDR_UNDEF; int *data = NULL; H5F_t *f = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("Minimum Metadata threshold Processing"); HDprintf("\n"); @@ -1157,8 +1144,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* create the file */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file_id))) @@ -1693,8 +1678,6 @@ api_ctx_pushed = TRUE; if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; HDfree(data); @@ -1708,7 +1691,6 @@ error: H5Pclose(fapl); H5Pclose(fcpl); H5Fclose(file_id); -if(api_ctx_pushed) H5CX_pop(); if(data) HDfree(data); } H5E_END_TRY; @@ -1763,7 +1745,6 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) haddr_t raw_addr = HADDR_UNDEF; int *data = NULL; H5F_t *f = NULL; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ TESTING("Statistics Collection"); @@ -1793,8 +1774,6 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file_id))) @@ -2005,8 +1984,6 @@ api_ctx_pushed = TRUE; FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) FAIL_STACK_ERROR; -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; HDfree(data); @@ -2018,7 +1995,6 @@ error: H5Pclose(fapl); H5Pclose(fcpl); H5Fclose(file_id); -if(api_ctx_pushed) H5CX_pop(); if(data) HDfree(data); } H5E_END_TRY; @@ -2161,6 +2137,7 @@ main(void) hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ const char *env_h5_drvr = NULL; /* File Driver value from environment */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); @@ -2186,6 +2163,10 @@ main(void) PUTS_ERROR("Can't get VFD-dependent fapl") } /* end if */ + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; + #ifdef H5_HAVE_PARALLEL HDputs("Page Buffering is disabled for parallel."); @@ -2206,12 +2187,15 @@ main(void) if(nerrors) goto error; + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + HDputs("All Page Buffering tests passed."); HDexit(EXIT_SUCCESS); error: - HDprintf("***** %d Page Buffering TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); @@ -2219,7 +2203,8 @@ error: H5Pclose(fapl); } H5E_END_TRY; - HDexit(EXIT_FAILURE); + if(api_ctx_pushed) H5CX_pop(); + HDexit(EXIT_FAILURE); } /* main() */ diff --git a/test/unregister.c b/test/unregister.c index 4d7c902..dbf6293 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -231,13 +231,15 @@ main(void) { hid_t fapl; int nerrors = 0; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); -if(H5CX_push() < 0) FAIL_STACK_ERROR -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) FAIL_STACK_ERROR + api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); @@ -245,9 +247,12 @@ api_ctx_pushed = TRUE; if(nerrors) goto error; printf("All filter unregistration tests passed.\n"); + + /* Pop API context */ + if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR + api_ctx_pushed = FALSE; + h5_cleanup(FILENAME, fapl); -if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR -api_ctx_pushed = FALSE; return 0; @@ -255,7 +260,9 @@ error: nerrors = MAX(1, nerrors); printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); -if(api_ctx_pushed) H5CX_pop(); + + if(api_ctx_pushed) H5CX_pop(); + return 1; } diff --git a/testpar/t_file.c b/testpar/t_file.c index f8bf7b3..f670034 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -128,7 +128,7 @@ test_page_buffer_access(void) H5F_t *f = NULL; herr_t ret; /* generic return value */ const char *filename; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -194,9 +194,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_self); VRFY((file_id >= 0), ""); -ret = H5CX_push(); -VRFY((ret == 0), "H5CX_push()"); -api_ctx_pushed = TRUE; + + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ f = (H5F_t *)H5I_object(file_id); @@ -282,7 +284,9 @@ api_ctx_pushed = TRUE; VRFY((ret >= 0), "H5Fclose succeeded"); ret = H5Pclose(fapl_self); VRFY((ret>=0), "H5Pclose succeeded"); -if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } } #endif @@ -297,9 +301,11 @@ if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_p file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); VRFY((file_id >= 0), ""); -ret = H5CX_push(); -VRFY((ret == 0), "H5CX_push()"); -api_ctx_pushed = TRUE; + + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; /* Get a pointer to the internal file object */ f = (H5F_t *)H5I_object(file_id); @@ -409,7 +415,9 @@ api_ctx_pushed = TRUE; VRFY((ret>=0), "H5Pclose succeeded"); ret = H5Pclose(fcpl); VRFY((ret>=0), "H5Pclose succeeded"); -if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } HDfree(data); data = NULL; @@ -433,7 +441,7 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str H5F_t *f = NULL; H5C_t *cache_ptr = NULL; H5AC_cache_config_t config; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); @@ -441,9 +449,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((ret == 0), ""); -ret = H5CX_push(); -VRFY((ret == 0), "H5CX_push()"); -api_ctx_pushed = TRUE; + + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; f = (H5F_t *)H5I_object(file_id); VRFY((f != NULL), ""); @@ -561,7 +571,9 @@ api_ctx_pushed = TRUE; VRFY((ret == 0), ""); ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); -if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } MPI_Barrier(MPI_COMM_WORLD); HDfree(data_array); @@ -586,7 +598,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, H5F_t *f = NULL; H5C_t *cache_ptr = NULL; H5AC_cache_config_t config; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; config.version = H5AC__CURR_CACHE_CONFIG_VERSION; @@ -601,9 +613,11 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl); H5Eprint2(H5E_DEFAULT, stderr); VRFY((file_id >= 0), ""); -ret = H5CX_push(); -VRFY((ret == 0), "H5CX_push()"); -api_ctx_pushed = TRUE; + + /* Push API context */ + ret = H5CX_push(); + VRFY((ret == 0), "H5CX_push()"); + api_ctx_pushed = TRUE; ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((ret == 0), ""); @@ -717,7 +731,10 @@ api_ctx_pushed = TRUE; VRFY((ret == 0), ""); ret = H5Sclose(mem_dataspace); VRFY((ret == 0), ""); -if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + + /* Pop API context */ + if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } + HDfree(data_array); return nerrors; diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 7e00b4f..b66e7ce 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -255,7 +255,7 @@ main(int argc, char *argv[]) size_t u; H5E_auto2_t func; void *edata; -hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; if(argc == 1) { @@ -289,11 +289,14 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ HDfprintf(stderr, "cannot open file\n"); HDexit(1); } /* end if */ -if(H5CX_push() < 0) { - HDfprintf(stderr, "cannot set API context\n"); - HDexit(1); -} -api_ctx_pushed = TRUE; + + /* Push API context */ + if(H5CX_push() < 0) { + HDfprintf(stderr, "cannot set API context\n"); + HDexit(1); + } + api_ctx_pushed = TRUE; + if(NULL == (f = (H5F_t *)H5I_object(fid))) { HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); @@ -719,7 +722,9 @@ api_ctx_pushed = TRUE; H5Pclose(fapl); H5Fclose(fid); -if(api_ctx_pushed) H5CX_pop(); + + /* Pop API context */ + if(api_ctx_pushed) H5CX_pop(); H5Eset_auto2(H5E_DEFAULT, func, edata); |