Remove unnecessary xstrdup from bppy_init

I saw that bppy_init used a non-const "char *".  Fixing this revealed
that the xstrdup here was also unnecessary, so this patch removes it.
This commit is contained in:
Tom Tromey 2022-12-07 08:10:55 -07:00
parent 3198c863f6
commit 3567f2bd66

View file

@ -938,16 +938,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
} }
case bp_watchpoint: case bp_watchpoint:
{ {
gdb::unique_xmalloc_ptr<char> spec = skip_spaces (spec);
copy_holder (xstrdup (skip_spaces (spec)));
char *copy = copy_holder.get ();
if (access_type == hw_write) if (access_type == hw_write)
watch_command_wrapper (copy, 0, internal_bp); watch_command_wrapper (spec, 0, internal_bp);
else if (access_type == hw_access) else if (access_type == hw_access)
awatch_command_wrapper (copy, 0, internal_bp); awatch_command_wrapper (spec, 0, internal_bp);
else if (access_type == hw_read) else if (access_type == hw_read)
rwatch_command_wrapper (copy, 0, internal_bp); rwatch_command_wrapper (spec, 0, internal_bp);
else else
error(_("Cannot understand watchpoint access type.")); error(_("Cannot understand watchpoint access type."));
break; break;