mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r8307] Purpose:
Code optimization Description: Fix H5S_select_copy so it doesn't call calloc() for allocating memory that will be immediately overwritten. Platforms tested: Solaris 2.7 (arabica) too small to require h5committest
This commit is contained in:
parent
1a867ef2db
commit
5bace59b99
@ -139,9 +139,11 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src)
|
||||
|
||||
/* Copy offset information */
|
||||
if(src->extent.u.simple.rank>0) {
|
||||
if (NULL==(dst->select.offset = H5FL_ARR_CALLOC(hssize_t,src->extent.u.simple.rank)))
|
||||
if (NULL==(dst->select.offset = H5FL_ARR_MALLOC(hssize_t,src->extent.u.simple.rank)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
|
||||
if(src->select.offset!=NULL)
|
||||
if(src->select.offset==NULL)
|
||||
HDmemset(dst->select.offset,0,(src->extent.u.simple.rank*sizeof(hssize_t)));
|
||||
else
|
||||
HDmemcpy(dst->select.offset,src->select.offset,(src->extent.u.simple.rank*sizeof(hssize_t)));
|
||||
} /* end if */
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user