* [PATCH] gdb: simplify vector construction in eval_op_rust_array
@ 2023-08-30 15:21 Simon Marchi
2023-08-30 17:09 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2023-08-30 15:21 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
Replace the manual fill of the vector with the appropriate std::vector
constructor that makes N copies of the provided value.
Change-Id: I579570748c48f53d35024105269d83c716294746
---
gdb/rust-lang.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 0e2ca090ba8c..5f97d24f2572 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1338,14 +1338,7 @@ eval_op_rust_array (struct type *expect_type, struct expression *exp,
error (_("Array with negative number of elements"));
if (noside == EVAL_NORMAL)
- {
- int i;
- std::vector<struct value *> eltvec (copies);
-
- for (i = 0; i < copies; ++i)
- eltvec[i] = elt;
- return value_array (0, eltvec);
- }
+ return value_array (0, std::vector<value *> (copies, elt));
else
{
struct type *arraytype
base-commit: 59487af3c8490bc5961d330bc0ef4d5f05ecdc59
--
2.42.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: simplify vector construction in eval_op_rust_array
2023-08-30 15:21 [PATCH] gdb: simplify vector construction in eval_op_rust_array Simon Marchi
@ 2023-08-30 17:09 ` Tom Tromey
2023-08-30 18:32 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2023-08-30 17:09 UTC (permalink / raw)
To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> Replace the manual fill of the vector with the appropriate std::vector
Simon> constructor that makes N copies of the provided value.
Thanks.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: simplify vector construction in eval_op_rust_array
2023-08-30 17:09 ` Tom Tromey
@ 2023-08-30 18:32 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2023-08-30 18:32 UTC (permalink / raw)
To: Tom Tromey, Simon Marchi via Gdb-patches
On 8/30/23 13:09, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> Replace the manual fill of the vector with the appropriate std::vector
> Simon> constructor that makes N copies of the provided value.
>
> Thanks.
> Approved-By: Tom Tromey <tom@tromey.com>
>
> Tom
Thanks, pushed.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-30 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 15:21 [PATCH] gdb: simplify vector construction in eval_op_rust_array Simon Marchi
2023-08-30 17:09 ` Tom Tromey
2023-08-30 18:32 ` Simon Marchi
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).