public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Remove unnecessary xstrdup from bppy_init
@ 2022-12-07 15:19 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-12-07 15:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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 | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 7a757432948..63b18bd0f92 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -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;
-- 
2.34.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 15:19 [pushed] Remove unnecessary xstrdup from bppy_init Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).