All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
To: lttng-dev@lists.lttng.org
Subject: [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const
Date: Mon, 28 Oct 2019 15:24:36 -0400	[thread overview]
Message-ID: <20191028192436.66672-1-jeremie.galarneau__5430.57856136642$1572290705$gmane$org@efficios.com> (raw)

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

             reply	other threads:[~2019-10-28 19:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 19:24 Jérémie Galarneau [this message]
     [not found] <20191028192436.66672-1-jeremie.galarneau@efficios.com>
2019-10-28 19:27 ` [PATCH urcu] cds_lfht_is_node_deleted parameter can be marked const Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20191028192436.66672-1-jeremie.galarneau__5430.57856136642$1572290705$gmane$org@efficios.com' \
    --to=jeremie.galarneau@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.