summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2019-04-17 21:53:40 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2019-04-17 21:53:40 (GMT)
commitfc47e2e07a252f9421c6d11e88cfd63e5a337183 (patch)
tree7e5d55c6e22dc6e99439db667a5bfc4ac8679e8e /src/H5Dint.c
parentb90b5be59bd7f38b92d575c7e6ce380ca15f10f7 (diff)
downloadhdf5-fc47e2e07a252f9421c6d11e88cfd63e5a337183.zip
hdf5-fc47e2e07a252f9421c6d11e88cfd63e5a337183.tar.gz
hdf5-fc47e2e07a252f9421c6d11e88cfd63e5a337183.tar.bz2
Changing the prefix of external file and VDS from empty string to null for performance improvement.
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 15a2050..736f17c 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1133,7 +1133,7 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **
/* filename is interpreted as relative to the current directory,
* does not need to be expanded
*/
- *file_prefix = "";
+ *file_prefix = NULL;
} /* end if */
else {
if(HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
@@ -1382,10 +1382,8 @@ done:
} /* end if */
if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
- if(new_dset->shared->extfile_prefix && new_dset->shared->extfile_prefix[0] != '\0')
- new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
- if(new_dset->shared->vds_prefix && new_dset->shared->vds_prefix[0] != '\0')
- new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
+ new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
+ new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
} /* end if */
new_dset->oloc.file = NULL;
@@ -1540,8 +1538,13 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
/* Check whether the external file prefix of the already open dataset
* matches the new external file prefix
*/
- if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ if(extfile_prefix && dataset->shared->extfile_prefix) {
+ if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ } else {
+ if(extfile_prefix || dataset->shared->extfile_prefix)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset")
+ }
/* Check if the object has been opened through the top file yet */
if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) {
@@ -1559,19 +1562,15 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
ret_value = dataset;
done:
- if(extfile_prefix && extfile_prefix[0] != '\0')
- extfile_prefix = (char *)H5MM_xfree(extfile_prefix);
- if(vds_prefix && vds_prefix[0] != '\0')
- vds_prefix = (char *)H5MM_xfree(vds_prefix);
+ extfile_prefix = (char *)H5MM_xfree(extfile_prefix);
+ vds_prefix = (char *)H5MM_xfree(vds_prefix);
if(ret_value == NULL) {
/* Free the location--casting away const*/
if(dataset) {
if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
- if(dataset->shared->extfile_prefix && dataset->shared->extfile_prefix[0] != '\0')
- dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
- if(dataset->shared->vds_prefix && dataset->shared->vds_prefix[0] != '\0')
- dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
+ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
+ dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
}
@@ -1950,12 +1949,10 @@ H5D_close(H5D_t *dataset)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
/* Free the external file prefix */
- if(dataset->shared->extfile_prefix && dataset->shared->extfile_prefix[0] != '\0')
- dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
+ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
/* Free the vds file prefix */
- if(dataset->shared->vds_prefix && dataset->shared->vds_prefix[0] != '\0')
- dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
+ dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
/* Release layout, fill-value, efl & pipeline messages */
if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT)