diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-06 16:38:02 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-04-06 16:38:02 (GMT) |
commit | e696bc826affa724e4f2a20cf566cd1eceac9ac4 (patch) | |
tree | b8d9b501b13f62b88f9bbfc96e00d60f097243a6 /src/H5Sselect.c | |
parent | 6612950317292ab684482b343b6b5551d02a77d4 (diff) | |
download | hdf5-e696bc826affa724e4f2a20cf566cd1eceac9ac4.zip hdf5-e696bc826affa724e4f2a20cf566cd1eceac9ac4.tar.gz hdf5-e696bc826affa724e4f2a20cf566cd1eceac9ac4.tar.bz2 |
[svn-r8308] Purpose:
Code optimization
Description:
Fix H5S_select_copy so it doesn't call calloc() for allocating memory that
will be immediately overwritten.
Platforms tested:
Solaris 2.7 (arabica)
too small to require h5committest
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r-- | src/H5Sselect.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c index c35f13e..8c10284 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -183,9 +183,11 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src) /* Copy offset information */ if(src->extent.u.simple.rank>0) { - if (NULL==(dst->select.offset = H5FL_ARR_CALLOC(hssize_t,src->extent.u.simple.rank))) + if (NULL==(dst->select.offset = H5FL_ARR_MALLOC(hssize_t,src->extent.u.simple.rank))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if(src->select.offset!=NULL) + if(src->select.offset==NULL) + HDmemset(dst->select.offset,0,(src->extent.u.simple.rank*sizeof(hssize_t))); + else HDmemcpy(dst->select.offset,src->select.offset,(src->extent.u.simple.rank*sizeof(hssize_t))); } /* end if */ else |