diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-13 23:26:04 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-13 23:26:04 (GMT) |
commit | 8f0a7d94658fe28559b8f351a434800285b33ce9 (patch) | |
tree | 688b637e3cef2540f86d1326c0dbdacdacbb4abb /src/H5S.c | |
parent | f3b26a8ce9798d8ce8c4b845b407778b4084b6d4 (diff) | |
download | hdf5-8f0a7d94658fe28559b8f351a434800285b33ce9.zip hdf5-8f0a7d94658fe28559b8f351a434800285b33ce9.tar.gz hdf5-8f0a7d94658fe28559b8f351a434800285b33ce9.tar.bz2 |
[svn-r8519] 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.c | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -1212,14 +1212,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"); - } /* end if */ - else - ds->select.offset = NULL; - /* Set the value for successful return */ ret_value=ds; @@ -1392,17 +1384,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 */ switch (space->extent.type) { |