This replaces two instances of manual string management in
dwarf2read.c with std::string.
gdb/ChangeLog
2020-01-08 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (parse_macro_definition): Use std::string.
(parse_macro_definition): Likewise.
Change-Id: Iec437100105484aa4a116fb5d651d7ed52ee9d81
+2020-01-08 Tom Tromey <tromey@adacore.com>
+
+ * dwarf2read.c (parse_macro_definition): Use std::string.
+ (parse_macro_definition): Likewise.
+
2020-01-08 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (abbrev_table_read_table): Use std::vector.
2020-01-08 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (abbrev_table_read_table): Use std::vector.
{
/* It's an object-like macro. */
int name_len = p - body;
{
/* It's an object-like macro. */
int name_len = p - body;
- char *name = savestring (body, name_len);
+ std::string name (body, name_len);
const char *replacement;
if (*p == ' ')
const char *replacement;
if (*p == ' ')
replacement = body + name_len;
}
replacement = body + name_len;
}
- macro_define_object (file, line, name, replacement);
-
- xfree (name);
+ macro_define_object (file, line, name.c_str (), replacement);
}
else if (*p == '(')
{
/* It's a function-like macro. */
}
else if (*p == '(')
{
/* It's a function-like macro. */
- char *name = savestring (body, p - body);
+ std::string name (body, p - body);
int argc = 0;
int argv_size = 1;
char **argv = XNEWVEC (char *, argv_size);
int argc = 0;
int argv_size = 1;
char **argv = XNEWVEC (char *, argv_size);
if (*p == ' ')
/* Perfectly formed definition, no complaints. */
if (*p == ' ')
/* Perfectly formed definition, no complaints. */
- macro_define_function (file, line, name,
+ macro_define_function (file, line, name.c_str (),
argc, (const char **) argv,
p + 1);
else if (*p == '\0')
{
/* Complain, but do define it. */
dwarf2_macro_malformed_definition_complaint (body);
argc, (const char **) argv,
p + 1);
else if (*p == '\0')
{
/* Complain, but do define it. */
dwarf2_macro_malformed_definition_complaint (body);
- macro_define_function (file, line, name,
+ macro_define_function (file, line, name.c_str (),
argc, (const char **) argv,
p);
}
argc, (const char **) argv,
p);
}
/* Just complain. */
dwarf2_macro_malformed_definition_complaint (body);
/* Just complain. */
dwarf2_macro_malformed_definition_complaint (body);