summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-05-13 23:26:10 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-05-13 23:26:10 (GMT)
commit6a806870e9938bf0651a7513c109489687b016bb (patch)
treeae62a7792ac7b1e851af807bfee6013e613cec1d /src/H5S.c
parenta9d354fd9592b44f250eb42efe450e26b7fd0d17 (diff)
downloadhdf5-6a806870e9938bf0651a7513c109489687b016bb.zip
hdf5-6a806870e9938bf0651a7513c109489687b016bb.tar.gz
hdf5-6a806870e9938bf0651a7513c109489687b016bb.tar.bz2
[svn-r8520] Purpose:
Code optimization Description: Don't make a separate allocation for the selection offset - incorporate it into the selection structure as a fixed size array. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) w/parallel
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/H5S.c b/src/H5S.c
index a7ede59..c183be7 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1205,13 +1205,6 @@ H5S_read(H5G_entry_t *ent, hid_t dxpl_id)
if(H5S_select_all(ds,0)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection");
- /* Allocate space for the offset and set it to zeros */
- if(ds->extent.u.simple.rank>0) {
- if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- } else
- ds->select.offset = NULL;
-
/* Set the value for successful return */
ret_value=ds;
@@ -1389,17 +1382,8 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims,
assert(rank<=H5S_MAX_RANK);
assert(0==rank || dims);
- /* If there was a previous offset for the selection, release it */
- if(space->select.offset!=NULL)
- space->select.offset=H5FL_ARR_FREE(hssize_t,space->select.offset);
-
- /* Allocate space for the offset and set it to zeros */
- if(rank>0) {
- if (NULL==(space->select.offset = H5FL_ARR_CALLOC(hssize_t,rank)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- } /* end if */
- else
- space->select.offset = NULL;
+ /* Set offset to zeros */
+ HDmemset(space->select.offset,0,sizeof(hssize_t)*rank);
/* shift out of the previous state to a "simple" dataspace. */
if(H5S_extent_release(&space->extent)<0)