public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Remove unnecessary xstrdup from bppy_init
Date: Wed,  7 Dec 2022 08:19:19 -0700	[thread overview]
Message-ID: <20221207151919.2894085-1-tromey@adacore.com> (raw)

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


                 reply	other threads:[~2022-12-07 15:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221207151919.2894085-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).