diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-06-25 14:54:33 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-06-25 14:54:33 (GMT) |
commit | b236c2160102a5ed6dd6bce7b0fea0613424981e (patch) | |
tree | 7ba842dd3453335cb5323c1ee0eeaafcf90e0a12 /src | |
parent | f9312d49d52ba6e6af4549907dd73a4901db6f70 (diff) | |
download | hdf5-b236c2160102a5ed6dd6bce7b0fea0613424981e.zip hdf5-b236c2160102a5ed6dd6bce7b0fea0613424981e.tar.gz hdf5-b236c2160102a5ed6dd6bce7b0fea0613424981e.tar.bz2 |
[svn-r30106] Moved datatype close code to new internal function. H5Oclose()
now supports evict-on-close for datatypes.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5O.c | 8 | ||||
-rw-r--r-- | src/H5T.c | 49 | ||||
-rw-r--r-- | src/H5Tprivate.h | 1 |
3 files changed, 45 insertions, 13 deletions
@@ -1069,14 +1069,18 @@ H5Oclose(hid_t object_id) /* Get the type of the object and close it in the correct way */ switch(H5I_get_type(object_id)) { case H5I_GROUP: - case H5I_DATATYPE: case H5I_DATASET: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") break; - + case H5I_DATATYPE: + if(H5I_object(object_id) == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") + if(H5T_close_id(object_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + break; case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -1696,30 +1696,57 @@ done: /*------------------------------------------------------------------------- - * Function: H5Tclose + * Function: H5Tclose * - * Purpose: Frees a datatype and all associated memory. + * Purpose: Frees a datatype and all associated memory. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Return: Non-negative on success/Negative on failure * - * Modifications: + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 * *------------------------------------------------------------------------- */ herr_t H5Tclose(hid_t type_id) { + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", type_id); + + /* Call internal function */ + if(H5T_close_id(type_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Tclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_close_id + * + * Purpose: Internal function to free a datatype and all associated + * memory. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5T_close_id(hid_t type_id) +{ H5T_t *dt; /* Pointer to datatype to close */ H5F_t *file = NULL; /* File */ hbool_t evict = FALSE; /* Evict metadata on close? */ haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", type_id); + FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) @@ -1756,8 +1783,8 @@ H5Tclose(hid_t type_id) } /* end if */ done: - FUNC_LEAVE_API(ret_value) -} /* end H5Tclose() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_close_id() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 17826ae..45d8d76 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -108,6 +108,7 @@ H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); H5_DLL herr_t H5T_close(H5T_t *dt); +H5_DLL herr_t H5T_close_id(hid_t type_id); H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); |