From c1660067e3dcbcdd2fd990beedcc699e0a858c39 Mon Sep 17 00:00:00 2001 From: Willem Jan Withagen Date: Tue, 2 Oct 2018 10:48:59 +0200 Subject: [PATCH] erasure-code: var-sized array init is done separatly. ``` /home/jenkins/workspace/ceph-master/src/erasure-code/clay/ErasureCodeClay.cc:391:21: error: variable-sized object may not be initialized int weight_vector[t] = {0}; ^ 1 error generated. ``` And GCC doesn't like: ``` weight_vector = {0}; ``` So use std:fill() Signed-off-by: Willem Jan Withagen --- src/erasure-code/clay/ErasureCodeClay.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/erasure-code/clay/ErasureCodeClay.cc b/src/erasure-code/clay/ErasureCodeClay.cc index d4f25e31d5f..851d392346b 100644 --- a/src/erasure-code/clay/ErasureCodeClay.cc +++ b/src/erasure-code/clay/ErasureCodeClay.cc @@ -388,7 +388,8 @@ void ErasureCodeClay::get_repair_subchunks(const int &lost_node, int ErasureCodeClay::get_repair_sub_chunk_count(const set &want_to_read) { - int weight_vector[t] = {0}; + int weight_vector[t]; + std::fill(weight_vector, weight_vector + t, 0); for (auto to_read : want_to_read) { weight_vector[to_read / q]++; }