From afa5940dbe80a259cf8bc4a99403554a3c2c9e32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 28 Oct 2019 15:24:36 -0400 Subject: [PATCH 1/1] cds_lfht_is_node_deleted parameter can be marked const MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Mark the cds_lfht_node pointer parameter of cds_lfht_is_node_deleted as const. The fact that this parameter is mutable makes it harder to use liburcu in const-correct code. Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers --- include/urcu/rculfhash.h | 2 +- src/rculfhash.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/urcu/rculfhash.h b/include/urcu/rculfhash.h index cbf513e..20b822f 100644 --- a/include/urcu/rculfhash.h +++ b/include/urcu/rculfhash.h @@ -499,7 +499,7 @@ int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node); * This function does not issue any memory barrier. */ extern -int cds_lfht_is_node_deleted(struct cds_lfht_node *node); +int cds_lfht_is_node_deleted(const struct cds_lfht_node *node); /* * cds_lfht_resize - Force a hash table resize diff --git a/src/rculfhash.c b/src/rculfhash.c index 811d515..51972c8 100644 --- a/src/rculfhash.c +++ b/src/rculfhash.c @@ -826,7 +826,7 @@ struct cds_lfht_node *clear_flag(struct cds_lfht_node *node) } static -int is_removed(struct cds_lfht_node *node) +int is_removed(const struct cds_lfht_node *node) { return ((unsigned long) node) & REMOVED_FLAG; } @@ -1830,7 +1830,7 @@ int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node) return ret; } -int cds_lfht_is_node_deleted(struct cds_lfht_node *node) +int cds_lfht_is_node_deleted(const struct cds_lfht_node *node) { return is_removed(CMM_LOAD_SHARED(node->next)); } -- 2.34.1