aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-08-30 11:21:20 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-08-30 14:32:11 -0400
commit7c651c5fe6de738b0ce9b5b89568fde84eade807 (patch)
tree38ff0d783f3a9f0fe7783f588b0cd10977bda35e /gdb
parent0c164d29d11cdb71e29aca3e6bf352100ce6b6b6 (diff)
downloadgdb-7c651c5fe6de738b0ce9b5b89568fde84eade807.zip
gdb-7c651c5fe6de738b0ce9b5b89568fde84eade807.tar.gz
gdb-7c651c5fe6de738b0ce9b5b89568fde84eade807.tar.bz2
gdb: simplify vector construction in eval_op_rust_array
Replace the manual fill of the vector with the appropriate std::vector constructor that makes N copies of the provided value. Change-Id: I579570748c48f53d35024105269d83c716294746 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/rust-lang.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 0e2ca09..5f97d24 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