From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 5/8] Use gdb::byte_vector in load_progress
Date: Sun, 01 Oct 2017 04:07:00 -0000 [thread overview]
Message-ID: <20171001040643.25162-6-tom@tromey.com> (raw)
In-Reply-To: <20171001040643.25162-1-tom@tromey.com>
This changes load_progress to use gdb::byte_vector, removing a
cleanup.
2017-09-30 Tom Tromey <tom@tromey.com>
* symfile.c (load_progress): Use gdb::byte_vector.
---
gdb/ChangeLog | 4 ++++
gdb/symfile.c | 9 ++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ba841f8..f3faf73 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-09-30 Tom Tromey <tom@tromey.com>
+ * symfile.c (load_progress): Use gdb::byte_vector.
+
+2017-09-30 Tom Tromey <tom@tromey.com>
+
* mi/mi-main.c (mi_cmd_trace_frame_collected): Remove unused
declaration.
* printcmd.c (x_command): Remove unused declaration.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index f6bc378..a741654 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -56,6 +56,7 @@
#include "stack.h"
#include "gdb_bfd.h"
#include "cli/cli-utils.h"
+#include "common/byte-vector.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -1942,16 +1943,14 @@ load_progress (ULONGEST bytes, void *untyped_arg)
might add a verify_memory() method to the target vector and
then use that. remote.c could implement that method using
the ``qCRC'' packet. */
- gdb_byte *check = (gdb_byte *) xmalloc (bytes);
- struct cleanup *verify_cleanups = make_cleanup (xfree, check);
+ gdb::byte_vector check (bytes);
- if (target_read_memory (args->lma, check, bytes) != 0)
+ if (target_read_memory (args->lma, check.data (), bytes) != 0)
error (_("Download verify read failed at %s"),
paddress (target_gdbarch (), args->lma));
- if (memcmp (args->buffer, check, bytes) != 0)
+ if (memcmp (args->buffer, check.data (), bytes) != 0)
error (_("Download verify compare failed at %s"),
paddress (target_gdbarch (), args->lma));
- do_cleanups (verify_cleanups);
}
totals->data_count += bytes;
args->lma += bytes;
--
2.9.5
next prev parent reply other threads:[~2017-10-01 4:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-01 4:06 [RFA 0/8] more cleanup removal Tom Tromey
2017-10-01 4:06 ` [RFA 6/8] Remove make_delete_ui_cleanup Tom Tromey
2017-10-01 4:06 ` [RFA 4/8] Remove unused declarations Tom Tromey
2017-10-01 4:06 ` [RFA 8/8] Use std::string in info_symbol_command Tom Tromey
2017-10-01 4:07 ` [RFA 2/8] Remove set_batch_flag_and_make_cleanup_restore_page_info Tom Tromey
2017-10-01 4:07 ` [RFA 1/8] Change record_full_gdb_operation_disable_set not to return a cleanup Tom Tromey
2017-10-01 4:07 ` [RFA 7/8] Use std::string in gdb_safe_append_history Tom Tromey
2017-10-01 4:07 ` [RFA 3/8] Use std::string in utils.c Tom Tromey
2017-10-03 10:50 ` Pedro Alves
2017-10-03 11:26 ` Tom Tromey
2017-10-01 4:07 ` Tom Tromey [this message]
2017-10-03 10:55 ` [RFA 0/8] more cleanup removal 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=20171001040643.25162-6-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