Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 2/5] Remove regcache_xfree
Date: Sun, 24 Sep 2017 02:46:00 -0000	[thread overview]
Message-ID: <20170924024608.4346-3-tom@tromey.com> (raw)
In-Reply-To: <20170924024608.4346-1-tom@tromey.com>

This removes regcache_xfree in favor of plain "delete".

ChangeLog
2017-09-23  Tom Tromey  <tom@tromey.com>

	* spu-tdep.c (spu2ppu_dealloc_cache): Use delete.
	* regcache.h (regcache_xfree): Don't declare.
	* regcache.c (regcache_xfree): Remove.
	(do_regcache_xfree): Use delete.
	* ppc-linux-tdep.c (ppu2spu_dealloc_cache): Use delete.
	* linux-fork.c (free_fork): Use delete.
	(fork_save_infrun_state): Likewise.
	* jit.c (jit_dealloc_cache): Use delete.
	* infrun.c (discard_infcall_suspend_state): Use delete.
---
 gdb/ChangeLog        | 12 ++++++++++++
 gdb/infrun.c         |  2 +-
 gdb/jit.c            |  2 +-
 gdb/linux-fork.c     |  4 ++--
 gdb/ppc-linux-tdep.c |  2 +-
 gdb/regcache.c       | 11 +----------
 gdb/regcache.h       |  1 -
 gdb/spu-tdep.c       |  2 +-
 8 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 26853b1..f44ca91 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8921,7 +8921,7 @@ make_cleanup_restore_infcall_suspend_state
 void
 discard_infcall_suspend_state (struct infcall_suspend_state *inf_state)
 {
-  regcache_xfree (inf_state->registers);
+  delete inf_state->registers;
   xfree (inf_state->siginfo_data);
   xfree (inf_state);
 }
diff --git a/gdb/jit.c b/gdb/jit.c
index 6eea38f..a8e63b3 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -1167,7 +1167,7 @@ jit_dealloc_cache (struct frame_info *this_frame, void *cache)
   struct jit_unwind_private *priv_data = (struct jit_unwind_private *) cache;
 
   gdb_assert (priv_data->regcache != NULL);
-  regcache_xfree (priv_data->regcache);
+  delete priv_data->regcache;
   xfree (priv_data);
 }
 
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 22a11c6..6b9c6a8 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -126,7 +126,7 @@ free_fork (struct fork_info *fp)
   if (fp)
     {
       if (fp->savedregs)
-	regcache_xfree (fp->savedregs);
+	delete fp->savedregs;
       if (fp->filepos)
 	xfree (fp->filepos);
       xfree (fp);
@@ -292,7 +292,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
   DIR *d;
 
   if (fp->savedregs)
-    regcache_xfree (fp->savedregs);
+    delete fp->savedregs;
 
   fp->savedregs = regcache_dup (get_current_regcache ());
   fp->clobber_regs = clobber_regs;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 4c851eb..2faee42 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1382,7 +1382,7 @@ static void
 ppu2spu_dealloc_cache (struct frame_info *self, void *this_cache)
 {
   struct ppu2spu_cache *cache = (struct ppu2spu_cache *) this_cache;
-  regcache_xfree (cache->regcache);
+  delete cache->regcache;
 }
 
 static const struct frame_unwind ppu2spu_unwind = {
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 2a92cf0..54aed6c 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -241,19 +241,10 @@ regcache_get_ptid (const struct regcache *regcache)
   return regcache->ptid ();
 }
 
-void
-regcache_xfree (struct regcache *regcache)
-{
-  if (regcache == NULL)
-    return;
-
-  delete regcache;
-}
-
 static void
 do_regcache_xfree (void *data)
 {
-  regcache_xfree ((struct regcache *) data);
+  delete (struct regcache *) data;
 }
 
 struct cleanup *
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 877ed59..4a430ae 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -35,7 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t,
 							 struct gdbarch *,
 							 struct address_space *);
 
-void regcache_xfree (struct regcache *regcache);
 struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache);
 
 /* Return REGCACHE's ptid.  */
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4338d5c..f77e37f 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1288,7 +1288,7 @@ static void
 spu2ppu_dealloc_cache (struct frame_info *self, void *this_cache)
 {
   struct spu2ppu_cache *cache = (struct spu2ppu_cache *) this_cache;
-  regcache_xfree (cache->regcache);
+  delete cache->regcache;
 }
 
 static const struct frame_unwind spu2ppu_unwind = {
-- 
2.9.5


  parent reply	other threads:[~2017-09-24  2:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-24  2:46 [RFA 0/5] remove cleanups from regcache Tom Tromey
2017-09-24  2:46 ` [RFA 3/5] Remove make_cleanup_regcache_xfree Tom Tromey
2017-09-24  2:46 ` Tom Tromey [this message]
2017-09-24  2:46 ` [RFA 5/5] Remove the last cleanup from regcache.c Tom Tromey
2017-09-24  2:46 ` [RFA 4/5] Remove make_cleanup_regcache_invalidate Tom Tromey
2017-09-25 20:04   ` Yao Qi
2017-09-26  1:36     ` Tom Tromey
2017-09-26  1:56       ` Tom Tromey
2017-09-24  2:46 ` [RFA 1/5] Remove regcache_xmalloc Tom Tromey
2017-09-26  4:55   ` Tom Tromey
2017-09-26  5:10     ` Sergio Durigan Junior
2017-09-26  0:08 ` [RFA 0/5] remove cleanups from regcache Yao Qi

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=20170924024608.4346-3-tom@tromey.com \
    --to=tom@tromey.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