[lttng-dev] [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Mon Oct 28 15:27:58 EDT 2019
Merged into liburcu master, thanks!
Mathieu
----- On Oct 28, 2019, at 3:24 PM, Jeremie Galarneau jeremie.galarneau at efficios.com wrote:
> 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 <jeremie.galarneau at efficios.com>
> ---
> 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 ff42df0..8e60f19 100644
> --- a/src/rculfhash.c
> +++ b/src/rculfhash.c
> @@ -825,7 +825,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;
> }
> @@ -1829,7 +1829,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.23.0
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list