summaryrefslogtreecommitdiffstats
path: root/src/H5SL.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-08 09:38:32 (GMT)
committerGitHub <noreply@github.com>2022-05-08 09:38:32 (GMT)
commitea27e1380cf02e5f92d61cf9509596914c14e4df (patch)
treee753ad8ab4717fd9c1359b7a65dad274c599ca1c /src/H5SL.c
parentc0f314ad03f5ef0b4366ee625c83a7955a9ea87f (diff)
downloadhdf5-ea27e1380cf02e5f92d61cf9509596914c14e4df.zip
hdf5-ea27e1380cf02e5f92d61cf9509596914c14e4df.tar.gz
hdf5-ea27e1380cf02e5f92d61cf9509596914c14e4df.tar.bz2
Fixes for various warnings/alignment with develop branch (#1755)
Diffstat (limited to 'src/H5SL.c')
-rw-r--r--src/H5SL.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/H5SL.c b/src/H5SL.c
index 4d4c458..b3a91f2 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -880,10 +880,18 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
while (node) {
next_node = node->forward[0];
- /* Call callback, if one is given */
+ /* Call callback, if one is given.
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_DIAG_OFF("cast-qual")
if (op)
/* Casting away const OK -QAK */
(void)(op)(node->item, (void *)node->key, op_data);
+ H5_GCC_DIAG_ON("cast-qual")
node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward);
node = H5FL_FREE(H5SL_node_t, node);
@@ -2179,11 +2187,18 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data)
/* Protect against the node being deleted by the callback */
next = node->forward[0];
- /* Call the iterator callback */
- /* Casting away const OK -QAK */
+ /* Call the iterator callback
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_DIAG_OFF("cast-qual")
if (!node->removed)
if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0)
break;
+ H5_GCC_DIAG_ON("cast-qual")
/* Advance to next node */
node = next;
@@ -2336,10 +2351,17 @@ H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data)
while (node) {
/* Check if the node was already removed */
if (!node->removed) {
- /* Call callback */
- /* Casting away const OK -NAF */
+ /* Call callback, if one is given.
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_DIAG_OFF("cast-qual")
if ((op_ret = (op)(node->item, (void *)node->key, op_data)) < 0)
HGOTO_ERROR(H5E_SLIST, H5E_CALLBACK, FAIL, "callback operation failed")
+ H5_GCC_DIAG_ON("cast-qual")
/* Check if op indicated that the node should be removed */
if (op_ret)