diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-01-01 06:28:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-01-01 06:28:04 (GMT) |
commit | f60170dac7c491cc75120a6ebdfe73c13c0bab1d (patch) | |
tree | 6adfe7a8ccaa4c7cf6a0ae8aa2b4e7deb0518521 /src/H5Ocopy.c | |
parent | 8d8d56d7d1601a88b90524c7bcb78c2515ce770f (diff) | |
download | hdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.zip hdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.tar.gz hdf5-f60170dac7c491cc75120a6ebdfe73c13c0bab1d.tar.bz2 |
[svn-r28761] Description:
Clean up many mismatches between malloc/free and H5MM_malloc/H5MM_xfree
in the library and tests (and use of H5free_memory and H5Dvlen_reclaim). Also
make H5Ocopy use a private version of H5Lexists, which doesn't internally
throw (and suppress) errors when an object (or the path to it) isn't found in
the destination.
Tested on:
MacOSX/64 10.11.2 (amazon) w/serial & parallel
(h5committest forthcoming)
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r-- | src/H5Ocopy.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 02c72e7..6f42a88 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -213,10 +213,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* for opening the destination object */ H5G_name_t src_path; /* Opened source object hier. path */ H5O_loc_t src_oloc; /* Opened source object object location */ + htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, @@ -233,22 +233,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - { - H5G_name_t tmp_path; - H5O_loc_t tmp_oloc; - H5G_loc_t tmp_loc; - - /* Set up group location */ - tmp_loc.oloc = &tmp_oloc; - tmp_loc.path = &tmp_path; - H5G_loc_reset(&tmp_loc); - - /* Check if object already exists in destination */ - if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_ind_dxpl_id) >= 0) { - H5G_name_free(&tmp_path); - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists") - } /* end if */ - } + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + if(TRUE == dst_exists) + HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") /* Set up opened group location to fill in */ src_loc.oloc = &src_oloc; |