All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] getopt: change optstring to const char*
Date: Thu,  7 Feb 2013 21:36:18 +0100	[thread overview]
Message-ID: <1360269380-28155-3-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1360269380-28155-1-git-send-email-alex.aring@gmail.com>

Change getopt optstring parameter type to const char *.
Also change type to const char * of tmp variable which
pointed to optstring. This will only handle readonly.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/getopt.h | 2 +-
 lib/getopt.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/getopt.h b/include/getopt.h
index f23175f..4f48ba8 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -35,7 +35,7 @@ extern char *optarg;
  * - options can be mixed with nonoptions (like ls /bin -R)
  */
 
-int getopt(int argc, char *argv[], char *optstring);
+int getopt(int argc, char *argv[], const char *optstring);
 
 struct getopt_context {
 	int opterr;
diff --git a/lib/getopt.c b/lib/getopt.c
index ead9150..fd12a88 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -56,10 +56,10 @@ void getopt_context_restore(struct getopt_context *gc)
 }
 EXPORT_SYMBOL(getopt_context_restore);
 
-int getopt(int argc, char *argv[], char *optstring)
+int getopt(int argc, char *argv[], const char *optstring)
 {
 	char curopt;   /* current option character */
-	char *curoptp; /* pointer to the current option in optstring */
+	const char *curoptp; /* pointer to the current option in optstring */
 
 	while(1) {
 		debug("optindex: %d nonopts: %d optind: %d\n", optindex, nonopts, optind);
-- 
1.8.1.2


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

  parent reply	other threads:[~2013-02-07 20:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07 20:36 [PATCH 0/4] Small fixes in barebox Alexander Aring
2013-02-07 20:36 ` [PATCH 1/4] hush: add getopt only if it enabled Alexander Aring
2013-02-07 20:36 ` Alexander Aring [this message]
2013-02-07 20:36 ` [PATCH 3/4] sata-imx: fix depends on ARCH_IMX Alexander Aring
2013-02-07 20:36 ` [PATCH 4/4] net: fix cpsw depends on ARCH_OMAP Alexander Aring
2013-02-07 21:27   ` Alexander Aring
2013-02-07 21:35 ` [PATCH 0/4] Small fixes in barebox Sascha Hauer
2013-02-07 21:41   ` Sascha Hauer
2013-02-07 21:50     ` Alexander Aring
2013-02-08  8:29       ` Sascha Hauer
2013-02-07 21:47   ` Alexander Aring
  -- strict thread matches above, loose matches on Subject: below --
2013-02-07 21:31 [PATCH v2 " Alexander Aring
2013-02-07 21:31 ` [PATCH 2/4] getopt: change optstring to const char* Alexander Aring

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=1360269380-28155-3-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --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 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.