netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org
Subject: [libnftnl PATCH] ruleset: deconstify _get interface
Date: Mon, 20 Oct 2014 21:46:09 +0200	[thread overview]
Message-ID: <20141020194515.3402.28281.stgit@nfdev.cica.es> (raw)

Having this interface returning a const pointer makes very hard to
modificate the content of a chain contained in a nft_ruleset.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---

Note: I ignore how this affects the current, already released API.

 include/libnftnl/ruleset.h |    2 +-
 src/ruleset.c              |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/libnftnl/ruleset.h b/include/libnftnl/ruleset.h
index 6f89110..1a3e22f 100644
--- a/include/libnftnl/ruleset.h
+++ b/include/libnftnl/ruleset.h
@@ -28,7 +28,7 @@ enum {
 bool nft_ruleset_attr_is_set(const struct nft_ruleset *r, uint16_t attr);
 void nft_ruleset_attr_unset(struct nft_ruleset *r, uint16_t attr);
 void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data);
-const void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr);
+void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr);
 
 int nft_ruleset_parse(struct nft_ruleset *rs, enum nft_parse_type type,
 		      const char *data, struct nft_parse_err *err);
diff --git a/src/ruleset.c b/src/ruleset.c
index 4cfeee6..6bb7582 100644
--- a/src/ruleset.c
+++ b/src/ruleset.c
@@ -111,7 +111,7 @@ void nft_ruleset_attr_set(struct nft_ruleset *r, uint16_t attr, void *data)
 }
 EXPORT_SYMBOL(nft_ruleset_attr_set);
 
-const void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr)
+void *nft_ruleset_attr_get(const struct nft_ruleset *r, uint16_t attr)
 {
 	if (!(r->flags & (1 << attr)))
 		return NULL;


             reply	other threads:[~2014-10-20 19:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 19:46 Arturo Borrero Gonzalez [this message]
2014-10-24  9:54 ` [libnftnl PATCH] ruleset: deconstify _get interface Pablo Neira Ayuso

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=20141020194515.3402.28281.stgit@nfdev.cica.es \
    --to=arturo.borrero.glez@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).