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>
This commit is contained in:
Simon Marchi
2023-08-30 11:21:20 -04:00
parent 0c164d29d1
commit 7c651c5fe6

View File

@@ -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