Use obstack_strdup more
This changes gdb to use obstack_strdup when appropriate, rather than the wordier obstack_copy0. gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use obstack_strdup. * typeprint.c (typedef_hash_table::find_global_typedef): Use obstack_strdup. * symfile.c (allocate_compunit_symtab): Use obstack_strdup. * stabsread.c (common_block_start): Use obstack_strdup. * objfiles.c (set_objfile_main_name, objfile): Use obstack_strdup. * namespace.c (add_using_directive): Use obstack_strdup. * mdebugread.c (parse_symbol, parse_type): Use obstack_strdup. * jit.c (finalize_symtab): Use obstack_strdup. * dwarf2read.c (fixup_go_packaging, dwarf2_physname) (guess_partial_die_structure_name, partial_die_info::fixup) (dwarf2_name): Use obstack_strdup. * coffread.c (coff_read_struct_type, coff_read_enum_type): Use obstack_strdup. * c-exp.y (scan_macro_expansion): Use obstack_strdup. * buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use obstack_strdup. * ada-lang.c (ada_decode_symbol): Use obstack_strdup.
This commit is contained in:
parent
b3c6d7ff98
commit
021887d88a
14 changed files with 57 additions and 72 deletions
|
@ -9806,9 +9806,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
|
|||
{
|
||||
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
||||
const char *saved_package_name
|
||||
= (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
|
||||
package_name,
|
||||
strlen (package_name));
|
||||
= obstack_strdup (&objfile->per_bfd->storage_obstack, package_name);
|
||||
struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
|
||||
saved_package_name);
|
||||
struct symbol *sym;
|
||||
|
@ -11070,9 +11068,7 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
|
|||
retval = canon;
|
||||
|
||||
if (need_copy)
|
||||
retval = ((const char *)
|
||||
obstack_copy0 (&objfile->per_bfd->storage_obstack,
|
||||
retval, strlen (retval)));
|
||||
retval = obstack_strdup (&objfile->per_bfd->storage_obstack, retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -18982,10 +18978,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
|
|||
{
|
||||
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
||||
struct_pdi->name
|
||||
= ((const char *)
|
||||
obstack_copy0 (&objfile->per_bfd->storage_obstack,
|
||||
actual_class_name,
|
||||
strlen (actual_class_name)));
|
||||
= obstack_strdup (&objfile->per_bfd->storage_obstack,
|
||||
actual_class_name);
|
||||
xfree (actual_class_name);
|
||||
}
|
||||
break;
|
||||
|
@ -19067,10 +19061,7 @@ partial_die_info::fixup (struct dwarf2_cu *cu)
|
|||
base = demangled;
|
||||
|
||||
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
||||
name
|
||||
= ((const char *)
|
||||
obstack_copy0 (&objfile->per_bfd->storage_obstack,
|
||||
base, strlen (base)));
|
||||
name = obstack_strdup (&objfile->per_bfd->storage_obstack, base);
|
||||
xfree (demangled);
|
||||
}
|
||||
}
|
||||
|
@ -22725,9 +22716,8 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
|
|||
|
||||
/* FIXME: we already did this for the partial symbol... */
|
||||
DW_STRING (attr)
|
||||
= ((const char *)
|
||||
obstack_copy0 (&objfile->per_bfd->storage_obstack,
|
||||
demangled, strlen (demangled)));
|
||||
= obstack_strdup (&objfile->per_bfd->storage_obstack,
|
||||
demangled);
|
||||
DW_STRING_IS_CANONICAL (attr) = 1;
|
||||
xfree (demangled);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue