From: Jérémie Galarneau Date: Mon, 28 Oct 2019 19:24:36 +0000 (-0400) Subject: cds_lfht_is_node_deleted parameter can be marked const X-Git-Tag: v0.12.0~6 X-Git-Url: https://git.lttng.org/?p=urcu.git;a=commitdiff_plain;h=afa5940dbe80a259cf8bc4a99403554a3c2c9e32;hp=9fd30396a597942084b007f33cc7f2c279f746e9;ds=sidebyside cds_lfht_is_node_deleted parameter can be marked const 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 --- 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)); }