diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-30 19:01:25 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-01-30 19:01:25 (GMT) |
commit | 9da387342eea566659daed83c850220cee041059 (patch) | |
tree | 4ef05589271e0800fb5bf853bad09cd1c4dfeb7c /src/H5VLint.c | |
parent | d1f2eff23148da5e39463bd351be51767755b1c1 (diff) | |
download | hdf5-9da387342eea566659daed83c850220cee041059.zip hdf5-9da387342eea566659daed83c850220cee041059.tar.gz hdf5-9da387342eea566659daed83c850220cee041059.tar.bz2 |
Added a free wrapper that lets us free constant pointers without
generating warnings.
Also, brought the const-ness of the VOL connector info in line with
the VFD info (not visible externally).
Diffstat (limited to 'src/H5VLint.c')
-rw-r--r-- | src/H5VLint.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/H5VLint.c b/src/H5VLint.c index 39b0f53..df1f7a4 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -318,7 +318,7 @@ H5VL__free_cls(H5VL_class_t *cls) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") /* Release the class */ - H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */ + H5MM_xfree_const(cls->name); H5FL_FREE(H5VL_class_t, cls); done: @@ -670,6 +670,7 @@ done: * *------------------------------------------------------------------------- */ +H5_GCC_DIAG_OFF(cast-qual) herr_t H5VL_conn_free(const H5VL_connector_prop_t *connector_prop) { @@ -681,19 +682,20 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop) /* Free the connector info (if it exists) and decrement the ID */ if(connector_prop->connector_id > 0) { if(connector_prop->connector_info) - /* Free the connector info */ - if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0) /* Casting away const OK - QAK */ + /* Free the connector info, ignoring the const */ + if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") /* Decrement reference count for connector ID */ if(H5I_dec_ref(connector_prop->connector_id) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") - } /* end if */ - } /* end if */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_conn_free() */ +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- @@ -1144,7 +1146,7 @@ H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) done: if(ret_value < 0 && saved) { if(saved->name) - H5MM_xfree((void *)(saved->name)); /* Casting away const OK -QAK */ + H5MM_xfree_const(saved->name); H5FL_FREE(H5VL_class_t, saved); } /* end if */ |