From 9da387342eea566659daed83c850220cee041059 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 30 Jan 2020 11:01:25 -0800 Subject: 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). --- src/H5CX.c | 6 ++++-- src/H5Eint.c | 8 ++++---- src/H5FD.c | 13 ++++++++----- src/H5MM.c | 26 ++++++++++++++++++++++++++ src/H5MMprivate.h | 1 + src/H5Pfapl.c | 17 ++++++++++------- src/H5VLint.c | 14 ++++++++------ src/H5VLprivate.h | 2 +- 8 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/H5CX.c b/src/H5CX.c index 160aa84..244439e 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -1034,6 +1034,7 @@ H5CX_restore_state(const H5CX_state_t *api_state) * *------------------------------------------------------------------------- */ +H5_GCC_DIAG_OFF(cast-qual) herr_t H5CX_free_state(H5CX_state_t *api_state) { @@ -1071,9 +1072,9 @@ H5CX_free_state(H5CX_state_t *api_state) /* Release the VOL connector property, if it was set */ if(api_state->vol_connector_prop.connector_id) { - /* Clean up any VOL connector info */ + /* Clean up any VOL connector info, ignoring const-ness of connector info */ if(api_state->vol_connector_prop.connector_info) - if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0) + if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, (void *)api_state->vol_connector_prop.connector_info) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") /* Decrement connector ID */ if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0) @@ -1086,6 +1087,7 @@ H5CX_free_state(H5CX_state_t *api_state) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_free_state() */ +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5Eint.c b/src/H5Eint.c index e76db82..acd5b28 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -883,12 +883,12 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) /* Release strings */ if(error->func_name) - error->func_name = (const char *) H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */ + error->func_name = (const char *) H5MM_xfree_const(error->func_name); if(error->file_name) - error->file_name = (const char *) H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */ + error->file_name = (const char *) H5MM_xfree_const(error->file_name); if(error->desc) - error->desc = (const char *) H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */ - } /* end for */ + error->desc = (const char *) H5MM_xfree_const(error->desc); + } /* Decrement number of errors on stack */ estack->nused -= u; diff --git a/src/H5FD.c b/src/H5FD.c index 1a4ab4d..0cc5654 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -574,6 +574,7 @@ done: * *------------------------------------------------------------------------- */ +H5_GCC_DIAG_OFF(cast-qual) herr_t H5FD_fapl_close(hid_t driver_id, const void *driver_info) { @@ -591,17 +592,19 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) /* Allow driver to free info or do it ourselves */ if(driver_info) { if(driver->fapl_free) { - if((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */ + /* Free the const pointer (why we turn off the diagnostic) */ + if((driver->fapl_free)((void *)driver_info) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") - } /* end if */ + } else - driver_info = H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ - } /* end if */ - } /* end if */ + driver_info = H5MM_xfree_const(driver_info); + } + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_fapl_close() */ +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5MM.c b/src/H5MM.c index ac3c26e..dae3f81 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -566,6 +566,32 @@ H5MM_xfree(void *mem) /*------------------------------------------------------------------------- + * Function: H5MM_xfree_const + * + * Purpose: H5MM_xfree() wrapper that handles const pointers without + * warnings. Used for freeing buffers that should be regarded + * as const in use but need to be freed when no longer needed. + * + * Return: Success: NULL + * Failure: never fails + * + *------------------------------------------------------------------------- + */ +H5_GCC_DIAG_OFF(cast-qual) +void * +H5MM_xfree_const(const void *mem) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + H5MM_xfree((void *)mem); + + FUNC_LEAVE_NOAPI(NULL) +} /* end H5MM_xfree_const() */ +H5_GCC_DIAG_ON(cast-qual) + + +/*------------------------------------------------------------------------- * Function: H5MM_memcpy * * Purpose: Like memcpy(3) but with sanity checks on the parameters, diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 2053215..240b931 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -45,6 +45,7 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size); H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); +H5_DLL void *H5MM_xfree_const(const void *mem); H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); #if defined H5_MEMORY_ALLOC_SANITY_CHECK H5_DLL void H5MM_sanity_check_all(void); diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 3668229..f238466 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1146,6 +1146,7 @@ done: * *------------------------------------------------------------------------- */ +H5_GCC_DIAG_OFF(cast-qual) static herr_t H5P__file_driver_free(void *value) { @@ -1167,22 +1168,24 @@ H5P__file_driver_free(void *value) /* Allow driver to free info or do it ourselves */ if(driver->fapl_free) { - if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ + /* Free the const pointer (why we turn off the diagnostic) */ + if((driver->fapl_free)((void *)info->driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") - } /* end if */ + } else - H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ - } /* end if */ + H5MM_xfree_const(info->driver_info); + } /* Decrement reference count for driver */ if(H5I_dec_ref(info->driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") - } /* end if */ - } /* end if */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_free() */ +H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- @@ -5407,7 +5410,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) /* Prepare the VOL connector property */ vol_prop.connector_id = vol_id; - vol_prop.connector_info = (void *)vol_info; + vol_prop.connector_info = vol_info; /* Set the connector ID & info property */ if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) 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 */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 24ae1f3..27dd18c 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -44,7 +44,7 @@ typedef struct H5VL_object_t { /* Internal structure to hold the connector ID & info for FAPLs */ typedef struct H5VL_connector_prop_t { hid_t connector_id; /* VOL connector's ID */ - void *connector_info; /* VOL connector info, for open callbacks */ + const void *connector_info; /* VOL connector info, for open callbacks */ } H5VL_connector_prop_t; /* Which kind of VOL connector field to use for searching */ -- cgit v0.12 From 88b4c915e88681557e23702c571b458763a294b2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 30 Jan 2020 16:31:11 -0800 Subject: Updated the 'const memory free' changes based on PR feedback. --- src/H5CX.c | 6 ++---- src/H5FD.c | 17 ++++++++--------- src/H5FDprivate.h | 2 +- src/H5Fint.c | 2 +- src/H5MM.c | 5 ++--- src/H5Pfapl.c | 21 ++++----------------- src/H5VLcallback.c | 11 ++++++----- src/H5VLint.c | 6 ++---- src/H5VLprivate.h | 2 +- 9 files changed, 27 insertions(+), 45 deletions(-) diff --git a/src/H5CX.c b/src/H5CX.c index 244439e..160aa84 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -1034,7 +1034,6 @@ H5CX_restore_state(const H5CX_state_t *api_state) * *------------------------------------------------------------------------- */ -H5_GCC_DIAG_OFF(cast-qual) herr_t H5CX_free_state(H5CX_state_t *api_state) { @@ -1072,9 +1071,9 @@ H5CX_free_state(H5CX_state_t *api_state) /* Release the VOL connector property, if it was set */ if(api_state->vol_connector_prop.connector_id) { - /* Clean up any VOL connector info, ignoring const-ness of connector info */ + /* Clean up any VOL connector info */ if(api_state->vol_connector_prop.connector_info) - if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, (void *)api_state->vol_connector_prop.connector_info) < 0) + if(H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") /* Decrement connector ID */ if(H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0) @@ -1087,7 +1086,6 @@ H5CX_free_state(H5CX_state_t *api_state) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_free_state() */ -H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5FD.c b/src/H5FD.c index 0cc5654..7788f58 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -202,7 +202,7 @@ H5FD__free_cls(H5FD_class_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_free_cls() */ +} /* end H5FD__free_cls() */ /*------------------------------------------------------------------------- @@ -566,17 +566,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_close + * Function: H5FD_free_driver_info * - * Purpose: Closes a driver for a dataset transfer property list + * Purpose: Frees a driver's info * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -H5_GCC_DIAG_OFF(cast-qual) herr_t -H5FD_fapl_close(hid_t driver_id, const void *driver_info) +H5FD_free_driver_info(hid_t driver_id, const void *driver_info) { herr_t ret_value = SUCCEED; /* Return value */ @@ -592,8 +591,9 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) /* Allow driver to free info or do it ourselves */ if(driver_info) { if(driver->fapl_free) { - /* Free the const pointer (why we turn off the diagnostic) */ - if((driver->fapl_free)((void *)driver_info) < 0) + /* Free the const pointer */ + /* Cast through uintptr_t to de-const memory */ + if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } else @@ -603,8 +603,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_fapl_close() */ -H5_GCC_DIAG_ON(cast-qual) +} /* end H5FD_free_driver_info() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index ac08f7f..2e3d3ce 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -115,7 +115,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file); H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf); H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf); H5_DLL void *H5FD_fapl_get(H5FD_t *file); -H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl); +H5_DLL herr_t H5FD_free_driver_info(hid_t driver_id, const void *driver_info); H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref); H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); diff --git a/src/H5Fint.c b/src/H5Fint.c index 74189c1..0000512 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -273,7 +273,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) done: /* Release the copy of the driver info, if it was set up */ - if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) + if(driver_prop_copied && H5FD_free_driver_info(driver_prop.driver_id, driver_prop.driver_info) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5MM.c b/src/H5MM.c index dae3f81..94bd542 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -577,18 +577,17 @@ H5MM_xfree(void *mem) * *------------------------------------------------------------------------- */ -H5_GCC_DIAG_OFF(cast-qual) void * H5MM_xfree_const(const void *mem) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - H5MM_xfree((void *)mem); + /* Cast through uintptr_t to de-const memory */ + H5MM_xfree((void *)(uintptr_t)mem); FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree_const() */ -H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index f238466..9a04c3e 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1146,7 +1146,6 @@ done: * *------------------------------------------------------------------------- */ -H5_GCC_DIAG_OFF(cast-qual) static herr_t H5P__file_driver_free(void *value) { @@ -1159,22 +1158,11 @@ H5P__file_driver_free(void *value) /* Copy the driver & info, if there is one */ if(info->driver_id > 0) { - if(info->driver_info) { - H5FD_class_t *driver; /* Pointer to driver */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") - - /* Allow driver to free info or do it ourselves */ - if(driver->fapl_free) { - /* Free the const pointer (why we turn off the diagnostic) */ - if((driver->fapl_free)((void *)info->driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") - } - else - H5MM_xfree_const(info->driver_info); - } + /* Free the driver info, if it exists */ + if(info->driver_info) + if(H5FD_free_driver_info(info->driver_id, info->driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") /* Decrement reference count for driver */ if(H5I_dec_ref(info->driver_id) < 0) @@ -1185,7 +1173,6 @@ H5P__file_driver_free(void *value) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__file_driver_free() */ -H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index e4ebb95..5c54b5b 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -525,7 +525,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_free_connector_info(hid_t connector_id, void *info) +H5VL_free_connector_info(hid_t connector_id, const void *info) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -543,12 +543,13 @@ H5VL_free_connector_info(hid_t connector_id, void *info) if(info) { /* Allow the connector to free info or do it ourselves */ if(cls->info_cls.free) { - if((cls->info_cls.free)(info) < 0) + /* Cast through uintptr_t to de-const memory */ + if((cls->info_cls.free)((void *)(uintptr_t)info) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") - } /* end if */ + } else - H5MM_xfree(info); - } /* end if */ + H5MM_xfree_const(info); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5VLint.c b/src/H5VLint.c index df1f7a4..6572faa 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -670,7 +670,6 @@ done: * *------------------------------------------------------------------------- */ -H5_GCC_DIAG_OFF(cast-qual) herr_t H5VL_conn_free(const H5VL_connector_prop_t *connector_prop) { @@ -682,8 +681,8 @@ 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, ignoring the const */ - if(H5VL_free_connector_info(connector_prop->connector_id, (void *)connector_prop->connector_info) < 0) + /* Free the connector info */ + if(H5VL_free_connector_info(connector_prop->connector_id, 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 */ @@ -695,7 +694,6 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_conn_free() */ -H5_GCC_DIAG_ON(cast-qual) /*------------------------------------------------------------------------- diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 27dd18c..3235357 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -128,7 +128,7 @@ H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_in const void *src_info); H5_DLL herr_t H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, const void *info1, const void *info2); -H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, void *info); +H5_DLL herr_t H5VL_free_connector_info(hid_t connector_id, const void *info); /* Attribute functions */ H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -- cgit v0.12 From 10301154215fb6a22590e80f7b5ed0005f3e1786 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 30 Jan 2020 16:47:30 -0800 Subject: Minor refactoring to the VFD info free call. --- src/H5FD.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 7788f58..63112bd 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -581,7 +581,7 @@ H5FD_free_driver_info(hid_t driver_id, const void *driver_info) FUNC_ENTER_NOAPI(FAIL) - if(driver_id > 0) { + if(driver_id > 0 && driver_info) { H5FD_class_t *driver; /* Retrieve the driver for the ID */ @@ -589,16 +589,14 @@ H5FD_free_driver_info(hid_t driver_id, const void *driver_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Allow driver to free info or do it ourselves */ - if(driver_info) { - if(driver->fapl_free) { - /* Free the const pointer */ - /* Cast through uintptr_t to de-const memory */ - if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") - } - else - driver_info = H5MM_xfree_const(driver_info); + if(driver->fapl_free) { + /* Free the const pointer */ + /* Cast through uintptr_t to de-const memory */ + if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") } + else + driver_info = H5MM_xfree_const(driver_info); } done: -- cgit v0.12