summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-22 20:21:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-22 20:21:51 (GMT)
commit253ee36580536cb1ebcc51876ee841538d0a83eb (patch)
tree808502fbc18eecba4c0db8eafcd95ddddd04e345 /src/H5S.c
parent6010b691f953b8aeb167d694ff09b5b1f88b14b1 (diff)
downloadhdf5-253ee36580536cb1ebcc51876ee841538d0a83eb.zip
hdf5-253ee36580536cb1ebcc51876ee841538d0a83eb.tar.gz
hdf5-253ee36580536cb1ebcc51876ee841538d0a83eb.tar.bz2
[svn-r8409] 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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 7b7354e..6f9b03a 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -645,11 +645,14 @@ 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_SCALAR:
- /*nothing needed */
+ dst->u.simple.size=NULL;
+ dst->u.simple.max=NULL;
break;
case H5S_SIMPLE:
@@ -658,11 +661,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:
@@ -707,8 +714,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)