diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-22 20:21:44 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-22 20:21:44 (GMT) |
commit | d9ccc0e0f5edf32e0b70355f4cf2cfb583a12482 (patch) | |
tree | 7513d40d7cbc7ac7f89915be80aeb3bfc7f7acd1 /src/H5S.c | |
parent | e8e696542f60b1749d1ad8e89d561afc50b387e7 (diff) | |
download | hdf5-d9ccc0e0f5edf32e0b70355f4cf2cfb583a12482.zip hdf5-d9ccc0e0f5edf32e0b70355f4cf2cfb583a12482.tar.gz hdf5-d9ccc0e0f5edf32e0b70355f4cf2cfb583a12482.tar.bz2 |
[svn-r8408] Purpose:
Code optimization
Description:
Instead of dynamicly allocating various arrays for various pieces of
information about a selection or selection iterator, just use fixed size
array of size H5S_MAX_RANK (as the rest of the library does).
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -645,12 +645,15 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) FUNC_ENTER_NOAPI(H5S_extent_copy, FAIL); /* Copy the regular fields */ - *dst=*src; + dst->type=src->type; + dst->nelem=src->nelem; + dst->u.simple.rank=src->u.simple.rank; switch (src->type) { case H5S_NULL: case H5S_SCALAR: - /*nothing needed */ + dst->u.simple.size=NULL; + dst->u.simple.max=NULL; break; case H5S_SIMPLE: @@ -659,11 +662,15 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) for (u = 0; u < src->u.simple.rank; u++) dst->u.simple.size[u] = src->u.simple.size[u]; } + else + dst->u.simple.size=NULL; if (src->u.simple.max) { dst->u.simple.max = H5FL_ARR_MALLOC(hsize_t,src->u.simple.rank); for (u = 0; u < src->u.simple.rank; u++) dst->u.simple.max[u] = src->u.simple.max[u]; } + else + dst->u.simple.max=NULL; break; case H5S_COMPLEX: @@ -708,8 +715,10 @@ H5S_copy(const H5S_t *src) if (NULL==(dst = H5FL_MALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); +#ifdef LATER /* Copy the field in the struct */ *dst = *src; +#endif /* LATER */ /* Copy the source dataspace's extent */ if (H5S_extent_copy(&(dst->extent),&(src->extent))<0) |