This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: constify ada_decode_symbol


This is a simple patch that came out of a larger patch series I'm
working on.

ada_decode_symbol can be a little more const-correct.
It still needs a cast, due to how it writes into 'gsymbol', but the
resulting API is better, as it exposes more const-ness to the caller.

Tested by rebuilding.

Tom

	* ada-lang.h (ada_decode_symbol): Make return type const.
	* ada-lang.c (ada_decode_symbol): Likewise.
---
 gdb/ada-lang.c |    6 +++---
 gdb/ada-lang.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 4488b88..ef808c4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1296,11 +1296,11 @@ static struct htab *decoded_names_store;
    const, but nevertheless modified to a semantically equivalent form
    when a decoded name is cached in it.  */
 
-char *
+const char *
 ada_decode_symbol (const struct general_symbol_info *gsymbol)
 {
-  char **resultp =
-    (char **) &gsymbol->language_specific.mangled_lang.demangled_name;
+  const char **resultp =
+    (const char **) &gsymbol->language_specific.mangled_lang.demangled_name;
 
   if (*resultp == NULL)
     {
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 509a229..418f8da 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -219,7 +219,7 @@ extern struct value *ada_get_decoded_value (struct value *value);
 
 extern struct type *ada_get_decoded_type (struct type *type);
 
-extern char *ada_decode_symbol (const struct general_symbol_info*);
+extern const char *ada_decode_symbol (const struct general_symbol_info *);
 
 extern const char *ada_decode (const char*);
 
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]