[PATCH] getopt.h: option.name should be "const char *"

Freddie Chopin freddie_chopin@op.pl
Fri Nov 8 22:56:00 GMT 2013


OK, I've got one more.

In getopt.h there's a struct option, which has a field "name" - type 
"char *". According to some sources I could find (and common sense), 
this should be "const char *".

http://linux.die.net/man/3/getopt_long
http://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html#Getopt-Long-Options

Regards,
FCh
-------------- next part --------------
From c2d102d5f929142a5dab5843c32df6c724be79ae Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Fri, 8 Nov 2013 23:53:04 +0100
Subject: [PATCH] getopt.h: option.name should be "const char *"

---
 newlib/libc/include/getopt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/getopt.h b/newlib/libc/include/getopt.h
index ba8da4a..e109f9e 100644
--- a/newlib/libc/include/getopt.h
+++ b/newlib/libc/include/getopt.h
@@ -104,7 +104,7 @@ extern "C"
 /* types defined by this include file */
   struct option
   {
-    char *name;			/* the name of the long option */
+    const char *name;	/* the name of the long option */
     int has_arg;		/* one of the above macros */
     int *flag;			/* determines if getopt_long() returns a
 				 * value for a long option; if it is
-- 
1.8.3.msysgit.0



More information about the Newlib mailing list