diff options
author | Tom Tromey <tromey@redhat.com> | 2013-01-21 18:03:08 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-01-21 18:03:08 +0000 |
commit | 9d2ceabe7fb356a5905dec679f87a40f4e5a896a (patch) | |
tree | 010ff8d7a62c284f5aa0721b9c63e125e0bf1a6e /gdb | |
parent | cfc594ee569f473094855682e5b2ec2738b0cf67 (diff) | |
download | gdb-9d2ceabe7fb356a5905dec679f87a40f4e5a896a.zip gdb-9d2ceabe7fb356a5905dec679f87a40f4e5a896a.tar.gz gdb-9d2ceabe7fb356a5905dec679f87a40f4e5a896a.tar.bz2 |
* symtab.c (struct demangled_name_entry) <mangled>: Now const.
(symbol_set_names): Remove casts. Handle field const-ness.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/symtab.c | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e63d10e..6a15e40 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-01-21 Tom Tromey <tromey@redhat.com> + * symtab.c (struct demangled_name_entry) <mangled>: Now const. + (symbol_set_names): Remove casts. Handle field const-ness. + +2013-01-21 Tom Tromey <tromey@redhat.com> + * dwarf2read.c (new_symbol_full): Remove cast. * symtab.c (symbol_set_demangled_name): Make 'name' const. * symtab.h (symbol_set_demangled_name): Update. diff --git a/gdb/symtab.c b/gdb/symtab.c index 68d654d..d40436a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -526,7 +526,7 @@ symbol_set_language (struct general_symbol_info *gsymbol, /* Objects of this type are stored in the demangled name hash table. */ struct demangled_name_entry { - char *mangled; + const char *mangled; char demangled[1]; }; @@ -758,7 +758,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, linkage_name_copy = linkage_name; } - entry.mangled = (char *) lookup_name; + entry.mangled = lookup_name; slot = ((struct demangled_name_entry **) htab_find_slot (objfile->demangled_names_hash, &entry, INSERT)); @@ -789,10 +789,12 @@ symbol_set_names (struct general_symbol_info *gsymbol, offsetof (struct demangled_name_entry, demangled) + demangled_len + 1); - (*slot)->mangled = (char *) lookup_name; + (*slot)->mangled = lookup_name; } else { + char *mangled_ptr; + /* If we must copy the mangled name, put it directly after the demangled name so we can have a single allocation. */ @@ -800,8 +802,9 @@ symbol_set_names (struct general_symbol_info *gsymbol, offsetof (struct demangled_name_entry, demangled) + lookup_len + demangled_len + 2); - (*slot)->mangled = &((*slot)->demangled[demangled_len + 1]); - strcpy ((*slot)->mangled, lookup_name); + mangled_ptr = &((*slot)->demangled[demangled_len + 1]); + strcpy (mangled_ptr, lookup_name); + (*slot)->mangled = mangled_ptr; } if (demangled_name != NULL) |