* [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const
@ 2019-10-28 19:24 Jérémie Galarneau
0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-10-28 19:24 UTC (permalink / raw
To: lttng-dev
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@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
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const
[not found] <20191028192436.66672-1-jeremie.galarneau@efficios.com>
@ 2019-10-28 19:27 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2019-10-28 19:27 UTC (permalink / raw
To: Jeremie Galarneau; +Cc: lttng-dev
Merged into liburcu master, thanks!
Mathieu
----- On Oct 28, 2019, at 3:24 PM, Jeremie Galarneau jeremie.galarneau@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@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
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-28 19:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-28 19:24 [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const Jérémie Galarneau
[not found] <20191028192436.66672-1-jeremie.galarneau@efficios.com>
2019-10-28 19:27 ` Mathieu Desnoyers
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.