This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/3] Constify 'la_name' in struct language_defn
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Mon, 28 Oct 2013 20:48:07 +0800
- Subject: [PATCH 1/3] Constify 'la_name' in struct language_defn
- Authentication-results: sourceware.org; auth=none
- References: <20131025041525 dot GC4769 at adacore dot 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