+2018-05-21 Tom Tromey <tom@tromey.com>
+
+ * tracepoint.c (trace_dump_actions): Use std::string.
+
2018-05-21 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Use std::string for original_name.
STEPPING_ACTIONS should be equal. */
if (stepping_frame == stepping_actions)
{
- char *cmd = NULL;
- struct cleanup *old_chain
- = make_cleanup (free_current_contents, &cmd);
int trace_string = 0;
if (*action_exp == '/')
info_args_command (NULL, from_tty);
else
{ /* variable */
+ std::string contents;
+ const char *exp = action_exp;
if (next_comma != NULL)
{
size_t len = next_comma - action_exp;
-
- cmd = (char *) xrealloc (cmd, len + 1);
- memcpy (cmd, action_exp, len);
- cmd[len] = 0;
+ contents = std::string (action_exp, len);
+ exp = contents.c_str ();
}
- else
- {
- size_t len = strlen (action_exp);
- cmd = (char *) xrealloc (cmd, len + 1);
- memcpy (cmd, action_exp, len + 1);
- }
-
- printf_filtered ("%s = ", cmd);
- output_command_const (cmd, from_tty);
+ printf_filtered ("%s = ", exp);
+ output_command_const (exp, from_tty);
printf_filtered ("\n");
}
action_exp = next_comma;
}
while (action_exp && *action_exp == ',');
-
- do_cleanups (old_chain);
}
}
}