Remove unnecessary xstrdup from bppy_init
authorTom Tromey <tromey@adacore.com>
Wed, 7 Dec 2022 15:10:55 +0000 (08:10 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 7 Dec 2022 15:12:03 +0000 (08:12 -0700)
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.

gdb/python/py-breakpoint.c

index 7a757432948f631cbafd8ef275a2688c0fd5039a..63b18bd0f92a4d412673794f3f3809611dc75b13 100644 (file)
@@ -938,16 +938,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
          }
        case bp_watchpoint:
          {
-           gdb::unique_xmalloc_ptr<char>
-             copy_holder (xstrdup (skip_spaces (spec)));
-           char *copy = copy_holder.get ();
+           spec = skip_spaces (spec);
 
            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)
-             awatch_command_wrapper (copy, 0, internal_bp);
+             awatch_command_wrapper (spec, 0, internal_bp);
            else if (access_type == hw_read)
-             rwatch_command_wrapper (copy, 0, internal_bp);
+             rwatch_command_wrapper (spec, 0, internal_bp);
            else
              error(_("Cannot understand watchpoint access type."));
            break;