diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-06 18:51:30 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-06 18:51:30 (GMT) |
commit | dedb402f2ecf65e2f5a43bc64d3fd66690961c7d (patch) | |
tree | 547f8dc145fba23e5c691f3bdcf9e04849c7f88c | |
parent | 9cf3bf50b6f8ca35f90e0a9d02b1ccfac08d093c (diff) | |
download | hdf5-dedb402f2ecf65e2f5a43bc64d3fd66690961c7d.zip hdf5-dedb402f2ecf65e2f5a43bc64d3fd66690961c7d.tar.gz hdf5-dedb402f2ecf65e2f5a43bc64d3fd66690961c7d.tar.bz2 |
[svn-r8313] Purpose:
Code optimization
Description:
Eliminate unnecessary allocation and point at existing data structure
instead.
Platforms tested:
Solaris 2.7 (arabica)
too minor to require h5committest
-rw-r--r-- | src/H5Shyper.c | 14 | ||||
-rw-r--r-- | src/H5Sselect.c | 14 |
2 files changed, 4 insertions, 24 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 726f7fe..55191cb 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -6147,8 +6147,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 */ @@ -6165,9 +6165,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; } /* end if */ @@ -6176,9 +6173,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; } /* end if */ @@ -6348,10 +6342,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); 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() */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 8c10284..1ca409c 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -44,9 +44,6 @@ static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); /* Declare external the free list for hssize_t arrays */ H5FL_ARR_EXTERN(hssize_t); -/* Declare external the free list for hsize_t arrays */ -H5FL_ARR_EXTERN(hsize_t); - /* Declare a free list to manage sequences of size_t */ H5FL_SEQ_DEFINE_STATIC(size_t); @@ -641,12 +638,8 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s sel_iter->rank=space->extent.u.simple.rank; if(sel_iter->rank>0) { - /* Allocate room for the dataspace dimensions */ - sel_iter->dims = H5FL_ARR_MALLOC(hsize_t,sel_iter->rank); - assert(sel_iter->dims); - - /* Keep a copy of the dataspace dimensions */ - HDmemcpy(sel_iter->dims,space->extent.u.simple.size,sel_iter->rank*sizeof(hsize_t)); + /* Point to the dataspace dimensions */ + sel_iter->dims=space->extent.u.simple.size; } /* end if */ else sel_iter->dims = NULL; @@ -910,9 +903,6 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter) /* Check args */ assert(sel_iter); - /* Release the array of dimensions common to all iterators */ - H5FL_ARR_FREE(hsize_t,sel_iter->dims); - /* Call selection type-specific release routine */ ret_value = (*sel_iter->iter_release)(sel_iter); |