summaryrefslogtreecommitdiffstats
path: root/src/H5Gdeprec.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-28 15:02:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-28 15:02:54 (GMT)
commitea343ef85416b42f68f28fb1024702c6726f7eea (patch)
treed5c401bf83f7f5578df06c54f9fd9fb198732ed2 /src/H5Gdeprec.c
parenteb16d8bc2b2f37c7a1d75fe7bf5258eba21515b2 (diff)
downloadhdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.zip
hdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.tar.gz
hdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.tar.bz2
[svn-r14115] Description:
Remove all plain calls to H5Gopen() from source, replacing them with either H5Gopen2(). Add test for H5Gopen1(). Reformatted several pieces of code, to clean them up. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r--src/H5Gdeprec.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 613c922..3814c44 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -215,11 +215,10 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gcreate1() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
- * Function: H5Gopen
+ * Function: H5Gopen1
*
* Purpose: Opens an existing group for modification. When finished,
* call H5Gclose() to close it and release resources.
@@ -234,18 +233,13 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Gopen(hid_t loc_id, const char *name)
+H5Gopen1(hid_t loc_id, const char *name)
{
- H5G_t *grp = NULL;
- H5G_loc_t loc;
- H5G_loc_t grp_loc; /* Location used to open group */
- H5G_name_t grp_path; /* Opened object group hier. path */
- H5O_loc_t grp_oloc; /* Opened object object location */
- H5O_type_t obj_type; /* Type of object at location */
- hbool_t loc_found = FALSE; /* Location at 'name' found */
+ H5G_t *grp = NULL; /* Group opened */
+ H5G_loc_t loc; /* Location of parent for group */
hid_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Gopen, FAIL)
+ FUNC_ENTER_API(H5Gopen1, FAIL)
H5TRACE2("i", "i*s", loc_id, name);
/* Check args */
@@ -254,24 +248,8 @@ H5Gopen(hid_t loc_id, const char *name)
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Set up opened group location to fill in */
- grp_loc.oloc = &grp_oloc;
- grp_loc.path = &grp_path;
- H5G_loc_reset(&grp_loc);
-
- /* Find the group object */
- if(H5G_loc_find(&loc, name, &grp_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
- loc_found = TRUE;
-
- /* Check that the object found is the correct type */
- if(H5O_obj_type(&grp_oloc, &obj_type, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
-
/* Open the group */
- if((grp = H5G_open(&grp_loc, H5AC_dxpl_id)) == NULL)
+ if((grp = H5G_open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
/* Register an atom for the group */
@@ -280,18 +258,13 @@ H5Gopen(hid_t loc_id, const char *name)
done:
if(ret_value < 0) {
- if(grp) {
- if(H5G_close(grp) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
- } /* end if */
- else {
- if(loc_found && H5G_loc_free(&grp_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- } /* end else */
+ if(grp && H5G_close(grp) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
} /* end if */
FUNC_LEAVE_API(ret_value)
-} /* end H5Gopen() */
+} /* end H5Gopen1() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------