summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-28 19:47:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-28 19:47:00 (GMT)
commita84811bfb889762150014188680fad0ce05877ba (patch)
treee2dac8f7d6d8a7c0e306d3706e4433bd31e70f0c /fortran/src
parent2785c61b8daddefe90c38f7e57d75957d906e8b8 (diff)
downloadhdf5-a84811bfb889762150014188680fad0ce05877ba.zip
hdf5-a84811bfb889762150014188680fad0ce05877ba.tar.gz
hdf5-a84811bfb889762150014188680fad0ce05877ba.tar.bz2
[svn-r14117] Description:
Move H5Glink() into "deprecated routines" section, replacing internal usage with H5Lcreate_hard/H5Lcreate_soft. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Solaris/32 5.10 (linew)
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/H5Gf.c75
1 files changed, 40 insertions, 35 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 55faff9..e69f91c 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -253,14 +253,13 @@ DONE:
*---------------------------------------------------------------------------*/
int_f
-nh5gclose_c ( hid_t_f *grp_id )
+nh5gclose_c(hid_t_f *grp_id)
{
- int ret_value = 0;
- hid_t c_grp_id;
+ int ret_value = 0;
- c_grp_id = (hid_t)*grp_id;
- if ( H5Gclose(c_grp_id) < 0 ) ret_value = -1;
- return ret_value;
+ if(H5Gclose((hid_t)*grp_id) < 0)
+ ret_value = -1;
+ return ret_value;
}
@@ -281,40 +280,46 @@ nh5gclose_c ( hid_t_f *grp_id )
*---------------------------------------------------------------------------*/
int_f
-nh5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen)
+nh5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name,
+ int_f *current_namelen, _fcd new_name, int_f *new_namelen)
{
- int ret_value = -1;
- hid_t c_loc_id;
- H5G_link_t c_link_type;
- char *c_current_name, *c_new_name;
- size_t c_current_namelen, c_new_namelen;
- herr_t c_ret_value;
- /*
- * Convert Fortran name to C name
- */
- c_current_namelen =*current_namelen;
- c_new_namelen =*new_namelen;
- c_current_name = (char *)HD5f2cstring(current_name, c_current_namelen);
- if (c_current_name == NULL) return ret_value;
+ char *c_current_name = NULL, *c_new_name = NULL;
+ int ret_value = -1;
- c_new_name = (char *)HD5f2cstring(new_name, c_new_namelen);
- if(c_new_name == NULL) { HDfree(c_current_name);
- return ret_value;
- }
- /*
- * Call H5Glink function
- */
- c_loc_id = *loc_id;
- c_link_type = (H5G_link_t)*link_type;
- c_ret_value = H5Glink(c_loc_id, c_link_type, c_current_name, c_new_name);
+ /*
+ * Convert Fortran name to C name
+ */
+ if(NULL == (c_current_name = (char *)HD5f2cstring(current_name, (size_t)*current_namelen)))
+ goto DONE;
+ if(NULL == (c_new_name = (char *)HD5f2cstring(new_name, (size_t)new_namelen)))
+ goto DONE;
- if(c_ret_value < 0) goto DONE;
- ret_value = 0;
+ /*
+ * Call appropriate link creation function
+ */
+ switch((H5G_link_t)*link_type) {
+ case H5L_TYPE_HARD:
+ if(H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto DONE;
+ break;
+
+ case H5L_TYPE_SOFT:
+ if(H5Lcreate_soft(c_current_name, (hid_t)*loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto DONE;
+ break;
+
+ default: /* Unknown/unhandled link type */
+ goto DONE;
+ } /* end switch */
+ ret_value = 0;
DONE:
- HDfree(c_current_name);
- HDfree(c_new_name);
- return ret_value ;
+ if(c_current_name)
+ HDfree(c_current_name);
+ if(c_new_name)
+ HDfree(c_new_name);
+
+ return ret_value ;
}
/*----------------------------------------------------------------------------