From 021887d88a040cf39f3afbd7da10bbe3ff1ad6c3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 18 May 2019 15:56:03 -0600 Subject: 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 * 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. --- gdb/mdebugread.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'gdb/mdebugread.c') diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 7d0cbb7..18c1d1f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1066,8 +1066,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, enum_sym = allocate_symbol (mdebugread_objfile); SYMBOL_SET_LINKAGE_NAME (enum_sym, - (char *) obstack_copy0 (&mdebugread_objfile->objfile_obstack, - f->name, strlen (f->name))); + obstack_strdup (&mdebugread_objfile->objfile_obstack, + f->name)); SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST; SYMBOL_TYPE (enum_sym) = t; SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; @@ -1688,9 +1688,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, else if (TYPE_NAME (tp) == NULL || strcmp (TYPE_NAME (tp), name) != 0) TYPE_NAME (tp) - = ((const char *) - obstack_copy0 (&mdebugread_objfile->objfile_obstack, - name, strlen (name))); + = obstack_strdup (&mdebugread_objfile->objfile_obstack, name); } } @@ -1726,9 +1724,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (TYPE_NAME (tp) == NULL || strcmp (TYPE_NAME (tp), name) != 0) TYPE_NAME (tp) - = ((const char *) - obstack_copy0 (&mdebugread_objfile->objfile_obstack, - name, strlen (name))); + = obstack_strdup (&mdebugread_objfile->objfile_obstack, name); } } if (t->bt == btTypedef) -- cgit v1.1