Skip to content

Commit 6893bac

Browse files
authored
Merge pull request ceph#56428 from tchaikov/wip-crush-no-vla
crush: use std::vector instead of variable length arrays Reviewed-by: Radoslaw Zarzynski <[email protected]>
2 parents 758aad3 + 1316974 commit 6893bac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/crush/CrushWrapper.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,14 +1610,14 @@ class CrushWrapper {
16101610
void do_rule(int rule, int x, std::vector<int>& out, int maxout,
16111611
const WeightVector& weight,
16121612
uint64_t choose_args_index) const {
1613-
int rawout[maxout];
1614-
char work[crush_work_size(crush, maxout)];
1615-
crush_init_workspace(crush, work);
1613+
std::vector<int> rawout(maxout);
1614+
std::vector<char> work(crush_work_size(crush, maxout));
1615+
crush_init_workspace(crush, std::data(work));
16161616
crush_choose_arg_map arg_map = choose_args_get_with_fallback(
16171617
choose_args_index);
1618-
int numrep = crush_do_rule(crush, rule, x, rawout, maxout,
1618+
int numrep = crush_do_rule(crush, rule, x, std::data(rawout), maxout,
16191619
std::data(weight), std::size(weight),
1620-
work, arg_map.args);
1620+
std::data(work), arg_map.args);
16211621
if (numrep < 0)
16221622
numrep = 0;
16231623
out.resize(numrep);

0 commit comments

Comments
 (0)