Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 1/3] Constify 'la_name' in struct language_defn
Date: Mon, 28 Oct 2013 12:50:00 -0000	[thread overview]
Message-ID: <1382964489-24307-1-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <20131025041525.GC4769@adacore.com>

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-10-28  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/language.c |    4 ++--
 gdb/language.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/language.c b/gdb/language.c
index dcad5f3..aa708b9 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -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;
 
diff --git a/gdb/language.h b/gdb/language.h
index 5e029ea..14aedb6 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -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).  */
 
-- 
1.7.7.6


  parent reply	other threads:[~2013-10-28 12:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18  0:54 [PATCH 1/2] New field la_varobj_ops " Yao Qi
2013-10-18  0:54 ` [PATCH 2/2] Remove varobj_language_string, languages and varobj_languages Yao Qi
2013-10-25  4:15   ` Joel Brobecker
2013-10-25 13:38     ` Yao Qi
2013-10-26  4:09       ` Joel Brobecker
2013-10-28 12:50     ` Yao Qi [this message]
2013-10-28 12:50       ` [PATCH 2/3] New field 'la_natural_name' in struct language_defn Yao Qi
2013-10-28 18:34         ` Tom Tromey
2013-10-29  8:41         ` Yao Qi
2013-11-07  7:18           ` Yao Qi
2013-10-28 12:50       ` [PATCH 3/3] Remove varobj_language_string, languages and varobj_languages Yao Qi
2013-10-28 18:52         ` Tom Tromey
2013-10-29  8:33           ` Yao Qi
2013-10-29 16:49             ` Eli Zaretskii
2013-10-31  3:10               ` Yao Qi
2013-10-31 17:31                 ` Eli Zaretskii
2013-11-07  7:23               ` Yao Qi
2013-10-28 15:02       ` [PATCH 1/3] Constify 'la_name' in struct language_defn Tom Tromey
2013-10-25  3:34 ` [PATCH 1/2] New field la_varobj_ops " Joel Brobecker
2013-10-25 13:16   ` Yao Qi
2013-10-27 12:04   ` Rename field 'lang' to 'lang_ops' ([PATCH 1/2] New field la_varobj_ops in struct language_defn) Yao Qi

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=1382964489-24307-1-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.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