+2020-02-19 Tom Tromey <tom@tromey.com>
+
+ * symtab.c (general_symbol_info::compute_and_set_names): Use
+ obstack_strndup. Simplify call to symbol_set_demangled_name.
+
2020-02-19 Simon Marchi <simon.marchi@efficios.com>
* dwarf2/read.c (allocate_signatured_type_table,
if (!copy_name)
m_name = linkage_name.data ();
else
- {
- char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
- linkage_name.length () + 1);
-
- memcpy (name, linkage_name.data (), linkage_name.length ());
- name[linkage_name.length ()] = '\0';
- m_name = name;
- }
+ m_name = obstack_strndup (&per_bfd->storage_obstack,
+ linkage_name.data (),
+ linkage_name.length ());
symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack);
return;
m_language = (*slot)->language;
m_name = (*slot)->mangled.data ();
- if ((*slot)->demangled != nullptr)
- symbol_set_demangled_name (this, (*slot)->demangled.get (),
- &per_bfd->storage_obstack);
- else
- symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack);
+ symbol_set_demangled_name (this, (*slot)->demangled.get (),
+ &per_bfd->storage_obstack);
}
/* See symtab.h. */