summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-29 15:58:51 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-29 15:58:51 (GMT)
commit772133345d8d685e236b803f57189be0e042ca03 (patch)
tree9b3c7ace15a41e5101ca8b30e125100407178fdb /src/H5I.c
parent63ead111fad0e28e95c84bab134e149f4e8cd0d0 (diff)
downloadhdf5-772133345d8d685e236b803f57189be0e042ca03.zip
hdf5-772133345d8d685e236b803f57189be0e042ca03.tar.gz
hdf5-772133345d8d685e236b803f57189be0e042ca03.tar.bz2
[svn-r22184] - make the H5I inc and dec ref count routines independent of the VOL wrapper id
- change the free function for the VOL wrapper ID to also dec the ref count of the object ID to 0
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c51
1 files changed, 12 insertions, 39 deletions
diff --git a/src/H5I.c b/src/H5I.c
index dd0c7b0..9ff2afd 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1267,33 +1267,21 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5Idec_ref(hid_t uid)
+H5Idec_ref(hid_t id)
{
- H5VL_id_wrapper_t *uid_info; /* user id structure */
int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("Is", "i", uid);
+ H5TRACE1("Is", "i", id);
/* Check arguments */
- if(uid < 0)
+ if(id < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID")
- if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid)) {
- if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
-
- if((ret_value = H5I_dec_app_ref(uid_info->obj_id)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count")
+ /* 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")
- if((ret_value = H5I_dec_app_ref(uid)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count")
- }
- else {
- /* Do actual decrement operation */
- if((ret_value = H5I_dec_app_ref(uid)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, FAIL, "can't decrement ID ref count")
- }
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Idec_ref() */
@@ -1482,35 +1470,20 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5Iinc_ref(hid_t uid)
+H5Iinc_ref(hid_t id)
{
- H5VL_id_wrapper_t *uid_info; /* user id structure */
int ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("Is", "i", uid);
+ H5TRACE1("Is", "i", id);
/* Check arguments */
- if(uid < 0)
+ if(id < 0)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID")
- if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid)) {
- if(NULL == (uid_info = (H5VL_id_wrapper_t *)H5I_object(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
-
- if((ret_value = H5I_inc_ref(uid_info->obj_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count")
-
- if((ret_value = H5I_inc_ref(uid, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count")
- }
- else {
- /* Do actual increment operation */
- if((ret_value = H5I_inc_ref(uid, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count")
- }
-
-
+ /* Do actual increment operation */
+ if((ret_value = H5I_inc_ref(id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count")
done:
FUNC_LEAVE_API(ret_value)