diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2012-09-05 18:13:15 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2012-09-05 18:13:15 (GMT) |
commit | 9ce6dadd4848ad1371d32f99d320efa87de32050 (patch) | |
tree | 1d301a6b3b50dda6b3f9490291c96c9cc0ec1f77 /src/H5Ocopy.c | |
parent | 60daa9be2b660c4583f581c85ea2177b060c4fcb (diff) | |
parent | 1c9e159ffe6cf85a5c076f747758dc47eb7a111a (diff) | |
download | hdf5-9ce6dadd4848ad1371d32f99d320efa87de32050.zip hdf5-9ce6dadd4848ad1371d32f99d320efa87de32050.tar.gz hdf5-9ce6dadd4848ad1371d32f99d320efa87de32050.tar.bz2 |
[svn-r22739] ported revisions 22615 to 22737 from the trunk
Diffstat (limited to 'src/H5Ocopy.c')
-rw-r--r-- | src/H5Ocopy.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 1d1aa90..f643842 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -1066,11 +1066,15 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ HDassert(oloc_src); HDassert(oloc_src->file); HDassert(H5F_addr_defined(oloc_src->addr)); HDassert(oloc_dst->file); + /* Intialize copy info before errors can be thrown */ + HDmemset(&cpy_info, 0, sizeof(H5O_copy_t)); + /* Get the copy property list */ if(NULL == (ocpy_plist = (H5P_genplist_t *)H5I_object(ocpypl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -1088,7 +1092,6 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") /* Convert copy flags into copy struct */ - HDmemset(&cpy_info, 0, sizeof(H5O_copy_t)); if((cpy_option & H5O_COPY_SHALLOW_HIERARCHY_FLAG) > 0) { cpy_info.copy_shallow = TRUE; cpy_info.max_depth = 1; @@ -1562,6 +1565,10 @@ done: * Programmer: Neil Fortner * Nov 3 2011 * + * Modifications: + * Vailin Choi; August 2012 + * Use H5O_obj_class to get object type instead of + * H5O_get_info(...TRUE....) saving time in traversing metadata. *------------------------------------------------------------------------- */ static herr_t @@ -1571,8 +1578,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_key_t *key = NULL; /* Skiplist key */ haddr_t *addr = NULL; /* Destination address */ hbool_t obj_inserted = FALSE; /* Object inserted into skip list */ - H5O_info_t oinfo; /* Object info */ H5A_attr_iter_op_t attr_op; /* Attribute iteration operator */ + const H5O_obj_class_t *obj_class = NULL; /* Type of object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1583,13 +1590,13 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, HDassert(udata->dst_dt_list); HDassert(udata->dst_root_loc); - /* Get the object's info */ - if(H5O_get_info(obj_oloc, udata->dxpl_id, TRUE, &oinfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") + /* Get pointer to object class for this object */ + if((obj_class = H5O_obj_class(obj_oloc, udata->dxpl_id)) == NULL) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") /* Check if the object is a datatype, a dataset using a committed * datatype, or contains an attribute using a committed datatype */ - if(oinfo.type == H5O_TYPE_NAMED_DATATYPE) { + if(obj_class->type == H5O_TYPE_NAMED_DATATYPE) { /* Allocate key */ if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") @@ -1614,7 +1621,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, obj_inserted = TRUE; } /* end if */ } /* end if */ - else if(oinfo.type == H5O_TYPE_DATASET) { + else if(obj_class->type == H5O_TYPE_DATASET) { /* Allocate key */ if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") |