mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r8309] Purpose:
Code optimization Description: Fix H5S_select_hyperslab to use arrays on the stack instead of dynamically allocating them each time. Platforms tested: Solaris 2.7 (arabica) too small to require h5committest
This commit is contained in:
parent
5bace59b99
commit
fde9bbabc4
@ -5550,8 +5550,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
|
||||
const hsize_t count[],
|
||||
const hsize_t *block)
|
||||
{
|
||||
hsize_t *_stride=NULL; /* Stride array */
|
||||
hsize_t *_block=NULL; /* Block size array */
|
||||
hsize_t _stride[H5O_LAYOUT_NDIMS]; /* Stride array */
|
||||
hsize_t _block[H5O_LAYOUT_NDIMS]; /* Block size array */
|
||||
unsigned u; /* Counters */
|
||||
H5S_hyper_dim_t *diminfo; /* per-dimension info for the selection */
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
@ -5568,9 +5568,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
|
||||
if(stride==NULL) {
|
||||
hsize_t fill=1;
|
||||
|
||||
/* Allocate temporary buffer */
|
||||
if ((_stride=H5FL_ARR_MALLOC(hsize_t,space->extent.u.simple.rank))==NULL)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for stride buffer");
|
||||
H5V_array_fill(_stride,&fill,sizeof(hssize_t),space->extent.u.simple.rank);
|
||||
stride = _stride;
|
||||
}
|
||||
@ -5579,9 +5576,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
|
||||
if(block==NULL) {
|
||||
hsize_t fill=1;
|
||||
|
||||
/* Allocate temporary buffer */
|
||||
if ((_block=H5FL_ARR_MALLOC(hsize_t,space->extent.u.simple.rank))==NULL)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for stride buffer");
|
||||
H5V_array_fill(_block,&fill,sizeof(hssize_t),space->extent.u.simple.rank);
|
||||
block = _block;
|
||||
}
|
||||
@ -5766,10 +5760,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
|
||||
space->select.iter_init=H5S_hyper_iter_init;
|
||||
|
||||
done:
|
||||
if(_stride!=NULL)
|
||||
H5FL_ARR_FREE(hsize_t,_stride);
|
||||
if(_block!=NULL)
|
||||
H5FL_ARR_FREE(hsize_t,_block);
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5S_select_hyperslab() */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user