diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Gf.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 1f45a94..0ca7e38 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -462,7 +462,7 @@ DONE: HDfree(c_src_name); if(c_dst_name) HDfree(c_dst_name); - return ret_value ; + return ret_value; } /*---------------------------------------------------------------------------- @@ -483,38 +483,31 @@ DONE: int_f nh5gmove2_c(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id, _fcd dst_name, int_f*dst_namelen) { - int ret_value = -1; - hid_t c_src_loc_id; - hid_t c_dst_loc_id; - char *c_src_name, *c_dst_name; - size_t c_src_namelen, c_dst_namelen; - herr_t c_ret_value; - /* - * Convert Fortran name to C name - */ - c_src_namelen = *src_namelen; - c_dst_namelen = *dst_namelen; - c_src_name = (char *)HD5f2cstring(src_name, c_src_namelen); - if(c_src_name == NULL) return ret_value; - - c_dst_name = (char *)HD5f2cstring(dst_name, c_dst_namelen); - if(c_dst_name == NULL) { HDfree(c_src_name); - return ret_value; - } - /* - * Call H5Gmove2 function - */ - c_src_loc_id = (hid_t)*src_loc_id; - c_dst_loc_id = (hid_t)*dst_loc_id; - c_ret_value = H5Gmove2(c_src_loc_id, c_src_name, c_dst_loc_id, c_dst_name); - if(c_ret_value < 0) goto DONE; + char *c_src_name = NULL, *c_dst_name = NULL; + int ret_value = -1; - ret_value = 0; + /* + * Convert Fortran name to C name + */ + if(NULL == (c_src_name = (char *)HD5f2cstring(src_name, (size_t)*src_namelen))) + goto DONE; + if(NULL == (c_dst_name = (char *)HD5f2cstring(dst_name, (size_t)*dst_namelen))) + goto DONE; + + /* + * Call H5Gmove2 function + */ + if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto DONE; + + ret_value = 0; DONE: - HDfree(c_src_name); - HDfree(c_dst_name); - return ret_value ; + if(c_src_name) + HDfree(c_src_name); + if(c_dst_name) + HDfree(c_dst_name); + return ret_value; } /*---------------------------------------------------------------------------- |