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 09/12] Remove cleanup from xstormy16-tdep.c
Date: Thu, 28 Sep 2017 19:50:00 -0000	[thread overview]
Message-ID: <20170928195011.27382-10-tom@tromey.com> (raw)
In-Reply-To: <20170928195011.27382-1-tom@tromey.com>

This removes a cleanup from xstormy16-tdep.c, using gdb::byte_vector.

gdb/ChangeLog
2017-09-28  Tom Tromey  <tom@tromey.com>

	* xstormy16-tdep.c (xstormy16_push_dummy_call): Use
	gdb::byte_vector.
---
 gdb/ChangeLog        |  5 +++++
 gdb/xstormy16-tdep.c | 13 +++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 40a6d98..bed4305 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -35,6 +35,7 @@
 #include "doublest.h"
 #include "osabi.h"
 #include "objfiles.h"
+#include "common/byte-vector.h"
 
 enum gdb_regnum
 {
@@ -276,21 +277,17 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
      wordaligned.  */
   for (j = nargs - 1; j >= i; j--)
     {
-      gdb_byte *val;
-      struct cleanup *back_to;
       const gdb_byte *bytes = value_contents (args[j]);
 
       typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
       slacklen = typelen & 1;
-      val = (gdb_byte *) xmalloc (typelen + slacklen);
-      back_to = make_cleanup (xfree, val);
-      memcpy (val, bytes, typelen);
-      memset (val + typelen, 0, slacklen);
+      gdb::byte_vector val (typelen + slacklen);
+      memcpy (val.data (), bytes, typelen);
+      memset (val.data () + typelen, 0, slacklen);
 
       /* Now write this data to the stack.  The stack grows upwards.  */
-      write_memory (stack_dest, val, typelen + slacklen);
+      write_memory (stack_dest, val.data (), typelen + slacklen);
       stack_dest += typelen + slacklen;
-      do_cleanups (back_to);
     }
 
   store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr);
-- 
2.9.5


  parent reply	other threads:[~2017-09-28 19:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 19:50 [RFA 00/12] some minor cleanup removals Tom Tromey
2017-09-28 19:50 ` [RFA 04/12] Remove cleanup from tilegx-tdep.c Tom Tromey
2017-09-28 22:00   ` Pedro Alves
2017-09-28 19:50 ` [RFA 02/12] Remove cleanup from display_gdb_prompt Tom Tromey
2017-09-28 21:56   ` Pedro Alves
2017-09-28 19:50 ` [RFA 11/12] Remove a cleanup from symtab.c Tom Tromey
2017-09-28 19:50 ` Tom Tromey [this message]
2017-09-28 19:50 ` [RFA 06/12] Remove cleanups from cp-support.c Tom Tromey
2017-09-28 19:50 ` [RFA 05/12] Remove some cleanups from stack.c Tom Tromey
2017-09-28 22:06   ` Pedro Alves
2017-09-28 19:50 ` [RFA 10/12] Remove cleanup from mt-tdep.c Tom Tromey
2017-09-28 19:50 ` [RFA 03/12] Remove cleanups from utils.c Tom Tromey
2017-09-28 22:00   ` Pedro Alves
2017-09-28 19:50 ` [RFA 12/12] Remove some unused declarations Tom Tromey
2017-09-28 19:50 ` [RFA 01/12] Introduce string_vprintf Tom Tromey
2017-09-28 21:53   ` Pedro Alves
2017-09-29  2:38     ` Tom Tromey
2017-09-29  3:00       ` Tom Tromey
2017-09-29 10:25         ` Pedro Alves
2017-09-28 19:50 ` [RFA 08/12] Remove cleanup from complaints.c Tom Tromey
2017-09-28 22:09   ` Pedro Alves
2017-09-28 20:11 ` [RFA 07/12] Remove some cleanups from tracepoint.c Tom Tromey
2017-09-28 21:04 ` [RFA 00/12] some minor cleanup removals Sergio Durigan Junior
2017-09-28 22:11   ` Pedro Alves

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=20170928195011.27382-10-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