[svn-r22679] Changed H5O_copy_search_comm_dt_check() to use H5O_obj_class() to get object type instead of H5O_get_info(...TRUE...) saving time in traversing metadata.

(This is part of the checkin to 1.8 branch #22677)
This commit is contained in:
Vailin Choi 2012-08-14 11:56:06 -05:00
parent a9602d1b34
commit 8b72343753

View File

@ -1565,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
@ -1574,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
@ -1586,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")
@ -1617,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")