summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-06-11 14:08:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-06-11 14:08:02 (GMT)
commitae6937242508bc78b76f7d0e4c0d9aaa2104ce30 (patch)
treea11d8965cccc347f485234d3f549a18023cbf9ad
parent958d370d13ce93cc079296cf7feb46e8ad0ad5d0 (diff)
downloadhdf5-ae6937242508bc78b76f7d0e4c0d9aaa2104ce30.zip
hdf5-ae6937242508bc78b76f7d0e4c0d9aaa2104ce30.tar.gz
hdf5-ae6937242508bc78b76f7d0e4c0d9aaa2104ce30.tar.bz2
[svn-r8656] Purpose:
Code optimization Description: Eliminate redundant memory allocation for type conversion of variable-length sequences. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest
-rw-r--r--src/H5Tconv.c5
-rw-r--r--src/H5Tvlen.c11
2 files changed, 6 insertions, 10 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index d9df736..89b33de 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2539,11 +2539,6 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, hsize_t nelmts,
src_base_size=H5T_get_size(src->parent);
dst_base_size=H5T_get_size(dst->parent);
- /* Get initial conversion buffer */
- conv_buf_size=MAX(src_base_size,dst_base_size);
- if ((conv_buf=H5FL_BLK_CALLOC(vlen_seq,conv_buf_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
-
/* Set up conversion path for base elements */
if (NULL==(tpath=H5T_path_find(src->parent, dst->parent, NULL, NULL, dxpl_id))) {
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatypes");
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 21628ef..09e67fb 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -546,12 +546,13 @@ H5T_vlen_str_mem_read(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void *bu
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_str_mem_read)
- /* check parameters */
- assert(s);
- assert(buf);
+ if(len>0) {
+ /* check parameters */
+ assert(s);
+ assert(buf);
- if(len>0)
HDmemcpy(buf,s,len);
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T_vlen_str_mem_read() */
@@ -782,7 +783,7 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED
/* check parameters */
assert(vl);
- assert(buf);
+ assert(seq_len==0 || buf);
assert(f);
/* Free heap object for old data. */