public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] 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-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3567f2bd6619cfabc58626075be068923483e4d3

commit 3567f2bd6619cfabc58626075be068923483e4d3
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Dec 7 08:10:55 2022 -0700

    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.

Diff:
---
 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;

^ 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 [binutils-gdb] 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).