diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-06-15 16:02:44 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-06-15 16:02:44 (GMT) |
commit | 7c18329abe3de6a0262914c7aeece57df95d95bd (patch) | |
tree | ea5f203581f1111e806c1927bb338db37e95c144 /src | |
parent | 193fc7a70fe457725a213ab9b0bebcb0df502ec1 (diff) | |
download | hdf5-7c18329abe3de6a0262914c7aeece57df95d95bd.zip hdf5-7c18329abe3de6a0262914c7aeece57df95d95bd.tar.gz hdf5-7c18329abe3de6a0262914c7aeece57df95d95bd.tar.bz2 |
[svn-r8692] Purpose:
Code optimization
Description:
Avoid making copy of default vlen allocation info when default DXPL is
used. Just retarget pointer to point to default info directly.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.10 (sleipnir) w/parallel
Too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 8 | ||||
-rw-r--r-- | src/H5Tconv.c | 5 | ||||
-rw-r--r-- | src/H5Tprivate.h | 2 | ||||
-rw-r--r-- | src/H5Tvlen.c | 17 |
4 files changed, 18 insertions, 14 deletions
@@ -3479,15 +3479,15 @@ done: herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) { - H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ + H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ + H5T_vlen_alloc_info_t *vl_alloc_info=&_vl_alloc_info; /* VL allocation info */ herr_t ret_value; FUNC_ENTER_API(H5Dvlen_reclaim, FAIL) H5TRACE4("e","iiix",type_id,space_id,plist_id,buf); /* Check args */ - if (H5I_DATATYPE!=H5I_get_type(type_id) || - H5I_DATASPACE!=H5I_get_type(space_id) || + if (H5I_DATATYPE!=H5I_get_type(type_id) || H5I_DATASPACE!=H5I_get_type(space_id) || buf==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") @@ -3503,7 +3503,7 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); /* Call H5Diterate with args, etc. */ - ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,&vl_alloc_info); + ret_value=H5Diterate(buf,type_id,space_id,H5T_vlen_reclaim,vl_alloc_info); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index a8d1e50..1c76a16 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2426,7 +2426,8 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dxpl_id) { - H5T_vlen_alloc_info_t vl_alloc_info;/* VL allocation information */ + H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ + H5T_vlen_alloc_info_t *vl_alloc_info=&_vl_alloc_info; /* VL allocation info */ H5T_path_t *tpath; /* Type conversion path */ hbool_t noop_conv=FALSE; /* Flag to indicate a noop conversion */ hbool_t write_to_file=FALSE; /* Flag to indicate writing to file */ @@ -2652,7 +2653,7 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end if */ /* Write sequence to destination location */ - if((*(dst->u.vlen.write))(dst->u.vlen.f,dxpl_id,&vl_alloc_info,d,conv_buf, b, (size_t)seq_len, dst_base_size)<0) + if((*(dst->u.vlen.write))(dst->u.vlen.f,dxpl_id,vl_alloc_info,d,conv_buf, b, (size_t)seq_len, dst_base_size)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data"); if(!noop_conv) { diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 31fa493..1e4893b 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -87,7 +87,7 @@ H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_op_data); -H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t *vl_alloc_info); +H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info); H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); H5_DLL htri_t H5T_is_sensible(const H5T_t *dt); H5_DLL htri_t H5T_committed(H5T_t *type); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 628c1e3..f0f5267 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -62,7 +62,7 @@ static herr_t H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_b /* Local variables */ /* Default settings for variable-length allocation routines */ -static const H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={ +static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={ H5D_XFER_VLEN_ALLOC_DEF, H5D_XFER_VLEN_ALLOC_INFO_DEF, H5D_XFER_VLEN_FREE_DEF, @@ -1158,11 +1158,14 @@ done: transfer property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + The VL_ALLOC_INFO pointer should point at already allocated memory to place + non-default property list info. If a default property list is used, the + VL_ALLOC_INFO pointer will be changed to point at the default information. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t *vl_alloc_info) +H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info) { H5P_genplist_t *plist; /* DX property list */ herr_t ret_value=SUCCEED; @@ -1174,20 +1177,20 @@ H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t *vl_alloc_info) /* Check for the default DXPL */ if(dxpl_id==H5P_DATASET_XFER_DEFAULT) - HDmemcpy(vl_alloc_info,&H5T_vlen_def_vl_alloc_info,sizeof(H5T_vlen_alloc_info_t)); + *vl_alloc_info=&H5T_vlen_def_vl_alloc_info; else { /* Check args */ if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get the allocation functions & information */ - if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&vl_alloc_info->alloc_func)<0) + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,&(*vl_alloc_info)->alloc_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&vl_alloc_info->alloc_info)<0) + if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&(*vl_alloc_info)->alloc_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,&vl_alloc_info->free_func)<0) + if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,&(*vl_alloc_info)->free_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") - if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&vl_alloc_info->free_info)<0) + if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&(*vl_alloc_info)->free_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") } /* end else */ |