diff options
author | Songyu Lu <songyulu@hdfgroup.org> | 2019-04-17 17:35:44 (GMT) |
---|---|---|
committer | Songyu Lu <songyulu@hdfgroup.org> | 2019-04-17 17:35:44 (GMT) |
commit | b90b5be59bd7f38b92d575c7e6ce380ca15f10f7 (patch) | |
tree | a0a8e3ecc8fa3e516b960bd68b7c1da81c948e9f /src/H5Dint.c | |
parent | 1c6bce2f9bacd25fe78e1d63cf85e62e499aacab (diff) | |
download | hdf5-b90b5be59bd7f38b92d575c7e6ce380ca15f10f7.zip hdf5-b90b5be59bd7f38b92d575c7e6ce380ca15f10f7.tar.gz hdf5-b90b5be59bd7f38b92d575c7e6ce380ca15f10f7.tar.bz2 |
Improving the condition checking of empty string.
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r-- | src/H5Dint.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index d4bd9c1..15a2050 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1382,9 +1382,9 @@ 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 != "") + 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 != "") + 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 = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ @@ -1559,18 +1559,18 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) ret_value = dataset; done: - if(extfile_prefix != "") + if(extfile_prefix && extfile_prefix[0] != '\0') extfile_prefix = (char *)H5MM_xfree(extfile_prefix); - if(vds_prefix != "") + if(vds_prefix && vds_prefix[0] != '\0') 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 != "") + 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 != "") + if(dataset->shared->vds_prefix && dataset->shared->vds_prefix[0] != '\0') dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); } @@ -1950,11 +1950,11 @@ 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 != "") + if(dataset->shared->extfile_prefix && dataset->shared->extfile_prefix[0] != '\0') dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); /* Free the vds file prefix */ - if(dataset->shared->vds_prefix != "") + if(dataset->shared->vds_prefix && dataset->shared->vds_prefix[0] != '\0') dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix); /* Release layout, fill-value, efl & pipeline messages */ |