ConnMan network manager
 help / color / mirror / Atom feed
From: Grant Erickson <gerickson@nuovations.com>
To: connman@lists.linux.dev
Subject: [PATCH] Const-qualify 'gchar *' arguments in ipconfig  getters/setters.
Date: Fri, 20 Oct 2023 13:25:14 -0700	[thread overview]
Message-ID: <F9F0D72A-3FF6-4045-B847-EA891BC4E0A8@nuovations.com> (raw)

Const-qualify the 'gchar *' arguments in ipconfig getter/setter
functions to make it clear to the compiler, static analyzers,
and human readers that there are no mutation side effects with
such arguments.
---
 src/ipconfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ipconfig.c b/src/ipconfig.c
index 34b1724a..bba25ede 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -344,7 +344,7 @@ static int write_ipv6_conf_value(const char *ifname, const char *suffix,
 	return write_conf_value(PROC_IPV6_CONF_PREFIX, ifname, suffix, value);
 }
 
-static bool get_ipv6_state(gchar *ifname)
+static bool get_ipv6_state(const gchar *ifname)
 {
 	int disabled;
 	bool enabled = false;
@@ -355,7 +355,7 @@ static bool get_ipv6_state(gchar *ifname)
 	return enabled;
 }
 
-static int set_ipv6_state(gchar *ifname, bool enable)
+static int set_ipv6_state(const gchar *ifname, bool enable)
 {
 	int disabled = enable ? 0 : 1;
 
@@ -364,7 +364,7 @@ static int set_ipv6_state(gchar *ifname, bool enable)
 	return write_ipv6_conf_value(ifname, "disable_ipv6", disabled);
 }
 
-static int get_ipv6_privacy(gchar *ifname)
+static int get_ipv6_privacy(const gchar *ifname)
 {
 	int value;
 
@@ -380,7 +380,7 @@ static int get_ipv6_privacy(gchar *ifname)
 /* Enable the IPv6 privacy extension for stateless address autoconfiguration.
  * The privacy extension is described in RFC 3041 and RFC 4941
  */
-static int set_ipv6_privacy(gchar *ifname, int value)
+static int set_ipv6_privacy(const gchar *ifname, int value)
 {
 	if (!ifname)
 		return -EINVAL;
-- 
2.42.0



             reply	other threads:[~2023-10-20 20:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 20:25 Grant Erickson [this message]
2023-10-21 21:16 ` [PATCH] Const-qualify 'gchar *' arguments in ipconfig getters/setters Marcus Folkesson
2023-11-02  4:20 ` [PATCH v2] " Grant Erickson
2023-11-07 15:39   ` Marcel Holtmann
2023-11-07 15:25 ` [PATCH] " Marcel Holtmann

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=F9F0D72A-3FF6-4045-B847-EA891BC4E0A8@nuovations.com \
    --to=gerickson@nuovations.com \
    --cc=connman@lists.linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).