mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-31 10:09:16 +08:00
Add obstack_strdup overload taking a std::string
This adds an obstack_strdup overload that takes a std::string, and changes a few spots in gdb to use it. gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Use obstack_strdup. * stabsread.c (read_type): Use obstack_strdup. * gdb_obstack.h (obstack_strdup): New overload. * dwarf2read.c (dwarf2_compute_name, create_dwo_unit_in_dwp_v1) (create_dwo_unit_in_dwp_v2, build_error_marker_type) (dwarf2_canonicalize_name): Use obstack_strdup. * dbxread.c (read_dbx_symtab): Use obstack_strdup. * cp-support.c (inspect_type, replace_typedefs_qualified_name): Use obstack_strdup.
This commit is contained in:
@ -244,7 +244,7 @@ inspect_type (struct demangle_parse_info *info,
|
||||
}
|
||||
|
||||
len = buf.size ();
|
||||
name = (char *) obstack_copy0 (&info->obstack, buf.c_str (), len);
|
||||
name = obstack_strdup (&info->obstack, buf.string ());
|
||||
|
||||
/* Turn the result into a new tree. Note that this
|
||||
tree will contain pointers into NAME, so NAME cannot
|
||||
@ -315,9 +315,7 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
|
||||
|
||||
buf.write (d_left (comp)->u.s_name.s, d_left (comp)->u.s_name.len);
|
||||
newobj.type = DEMANGLE_COMPONENT_NAME;
|
||||
newobj.u.s_name.s
|
||||
= (char *) obstack_copy0 (&info->obstack,
|
||||
buf.c_str (), buf.size ());
|
||||
newobj.u.s_name.s = obstack_strdup (&info->obstack, buf.string ());
|
||||
newobj.u.s_name.len = buf.size ();
|
||||
if (inspect_type (info, &newobj, finder, data))
|
||||
{
|
||||
@ -379,9 +377,7 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
|
||||
with a DEMANGLE_COMPONENT_NAME node containing the whole
|
||||
name. */
|
||||
ret_comp->type = DEMANGLE_COMPONENT_NAME;
|
||||
ret_comp->u.s_name.s
|
||||
= (char *) obstack_copy0 (&info->obstack,
|
||||
buf.c_str (), buf.size ());
|
||||
ret_comp->u.s_name.s = obstack_strdup (&info->obstack, buf.string ());
|
||||
ret_comp->u.s_name.len = buf.size ();
|
||||
inspect_type (info, ret_comp, finder, data);
|
||||
}
|
||||
|
Reference in New Issue
Block a user