This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Use range-based for loop in remote_add_target_side_condition
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 27 Feb 2017 18:55:17 -0000
- Subject: [binutils-gdb] Use range-based for loop in remote_add_target_side_condition
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8362122330c97c8c4a15da4e7ba8aa29f0c11157
commit 8362122330c97c8c4a15da4e7ba8aa29f0c11157
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon Feb 27 13:54:53 2017 -0500
Use range-based for loop in remote_add_target_side_condition
Using a range based for loop makes this code a bit more clean and
readable.
The comment above is clearly erroneous, so I've updated it.
gdb/ChangeLog:
* remote.c (remote_add_target_side_condition): Use range-based
for loop. Update comment.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/remote.c | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a7be826..a872f1b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-27 Simon Marchi <simon.marchi@ericsson.com>
+
+ * remote.c (remote_add_target_side_condition): Use range-based
+ for loop. Update comment.
+
2017-02-27 Yao Qi <yao.qi@linaro.org>
* f-typeprint.c (f_print_type): Check "varstring" is empty first.
diff --git a/gdb/remote.c b/gdb/remote.c
index 87fb6e0..aedbd08 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -9664,11 +9664,9 @@ remote_add_target_side_condition (struct gdbarch *gdbarch,
xsnprintf (buf, buf_end - buf, "%s", ";");
buf++;
- /* Send conditions to the target and free the vector. */
- for (int ix = 0; ix < bp_tgt->conditions.size (); ix++)
+ /* Send conditions to the target. */
+ for (struct agent_expr *aexpr : bp_tgt->conditions)
{
- struct agent_expr *aexpr = bp_tgt->conditions[ix];
-
xsnprintf (buf, buf_end - buf, "X%x,", aexpr->len);
buf += strlen (buf);
for (int i = 0; i < aexpr->len; ++i)