diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-03-15 21:54:30 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-03-15 21:54:30 (GMT) |
commit | 4a17aff4085ad6ee265b95730aca3f493056dec8 (patch) | |
tree | 8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /src/H5P.c | |
parent | 853ae26333592faf69cd8c454ef92ffea8549df5 (diff) | |
download | hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2 |
Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5P.c')
-rw-r--r-- | src/H5P.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -27,6 +27,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Ppkg.h" /* Property lists */ @@ -96,6 +97,7 @@ 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) @@ -109,6 +111,10 @@ H5Pcopy(hid_t id) 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)) { @@ -131,6 +137,8 @@ H5Pcopy(hid_t id) } /* 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() */ @@ -1501,6 +1509,7 @@ 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) @@ -1511,6 +1520,10 @@ H5Pclose(hid_t plist_id) /* 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) @@ -1518,6 +1531,8 @@ H5Pclose(hid_t plist_id) } /* 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() */ |