mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/4] net: dhcp: make unmodified variable const
Date: Mon, 14 Dec 2015 11:41:13 +0100	[thread overview]
Message-ID: <1450089674-25721-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1450089674-25721-1-git-send-email-s.hauer@pengutronix.de>

'str' in dhcp_set_string_options is never modified, so make it const.
With this we no longer have to cast away the const returned from getenv.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/dhcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 78e5fe0..4433b44 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -204,13 +204,13 @@ static void bootfile_vendorex_handle(struct dhcp_opt *opt, unsigned char *popt,
 static int dhcp_set_string_options(struct dhcp_opt *param, u8 *e)
 {
 	int str_len;
-	char* str = param->data;
+	const char *str = param->data;
 
 	if (!str && param->barebox_var_name && IS_ENABLED(CONFIG_ENVIRONMENT_VARIABLES))
-		str = (char*)getenv(param->barebox_var_name);
+		str = getenv(param->barebox_var_name);
 
 	if (!str && param->barebox_dhcp_global && IS_ENABLED(CONFIG_GLOBALVAR))
-		str = (char*)dhcp_get_barebox_global(param->barebox_dhcp_global);
+		str = dhcp_get_barebox_global(param->barebox_dhcp_global);
 
 	if (!str)
 		return 0;
-- 
2.6.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-12-14 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 10:41 [PATCH 1/4] net: dhcp: unify options and params Sascha Hauer
2015-12-14 10:41 ` [PATCH 2/4] net: dhcp: simplify dhcp_options_process Sascha Hauer
2015-12-14 10:41 ` Sascha Hauer [this message]
2015-12-14 10:41 ` [PATCH 4/4] net: resolv: Make argument const Sascha Hauer

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=1450089674-25721-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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