summaryrefslogtreecommitdiffstats
path: root/src/H5MM.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-30 19:01:25 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:31:54 (GMT)
commit5e76dccbe0f874e352813b5d24a6b84c80b59fcd (patch)
tree87ef50fea4c9853d40c1dd15a9566eb4c96b3f28 /src/H5MM.c
parentc3974173a14380069c336dc7e65184685f41f32b (diff)
downloadhdf5-5e76dccbe0f874e352813b5d24a6b84c80b59fcd.zip
hdf5-5e76dccbe0f874e352813b5d24a6b84c80b59fcd.tar.gz
hdf5-5e76dccbe0f874e352813b5d24a6b84c80b59fcd.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/H5MM.c')
-rw-r--r--src/H5MM.c26
1 files changed, 26 insertions, 0 deletions
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,