Constify 'la_name' in struct language_defn
authorYao Qi <yao@codesourcery.com>
Sat, 26 Oct 2013 07:37:15 +0000 (15:37 +0800)
committerYao Qi <yao@codesourcery.com>
Thu, 7 Nov 2013 07:06:50 +0000 (15:06 +0800)
Hi,
When I add another name of language, I find field 'la_name' can be
'const char *'.  This patch is to constify it.

gdb:

2013-11-07  Yao Qi  <yao@codesourcery.com>

* language.c (language_str): Return const char *.
(add_language): Add const to 'language_names'
* language.h (struct language_defn) <la_name>: Add const.
(language_str: Update declaration.

gdb/ChangeLog
gdb/language.c
gdb/language.h

index a282b82bb217a9bbba31a6e76dd2cb20a53d7bba..fee6b06c1be619a11584cc18c43f6239129b01a0 100644 (file)
@@ -1,3 +1,10 @@
+2013-11-07  Yao Qi  <yao@codesourcery.com>
+
+       * language.c (language_str): Return const char *.
+       (add_language): Add const to 'language_names'
+       * language.h (struct language_defn) <la_name>: Add const.
+       (language_str: Update declaration.
+
 2013-11-06  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * s390-linux-nat.c (s390_read_description): Consider the TE field
index dcad5f389b48cb64240ffbfd21a96afb62ab57e2..aa708b983a570a309e004d6cc26bb2b5134bad2b 100644 (file)
@@ -485,7 +485,7 @@ language_def (enum language lang)
 }
 
 /* Return the language as a string.  */
-char *
+const char *
 language_str (enum language lang)
 {
   int i;
@@ -520,7 +520,7 @@ void
 add_language (const struct language_defn *lang)
 {
   /* For the "set language" command.  */
-  static char **language_names = NULL;
+  static const char **language_names = NULL;
   /* For the "help set language" command.  */
   char *language_set_doc = NULL;
 
index 5e029ea00bad1eb65c5c8edc43b9f4b9d97fec54..14aedb615d3418cc9b38998f44a44dd1493be73d 100644 (file)
@@ -132,7 +132,7 @@ struct language_defn
   {
     /* Name of the language.  */
 
-    char *la_name;
+    const char *la_name;
 
     /* its symtab language-enum (defs.h).  */
 
@@ -488,7 +488,7 @@ extern enum language language_enum (char *str);
 
 extern const struct language_defn *language_def (enum language);
 
-extern char *language_str (enum language);
+extern const char *language_str (enum language);
 
 /* Add a language to the set known by GDB (at initialization time).  */
 
This page took 0.03021 seconds and 4 git commands to generate.