]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: var-sized array init is done separatly. 24365/head
authorWillem Jan Withagen <wjw@digiware.nl>
Tue, 2 Oct 2018 08:48:59 +0000 (10:48 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 3 Oct 2018 11:08:38 +0000 (13:08 +0200)
```
/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 <wjw@digiware.nl>
src/erasure-code/clay/ErasureCodeClay.cc

index d4f25e31d5f881af903457224289f71001ac6554..851d392346bcfd7efdc0ac1f5cf10649c35f4fed 100644 (file)
@@ -388,7 +388,8 @@ void ErasureCodeClay::get_repair_subchunks(const int &lost_node,
 
 int ErasureCodeClay::get_repair_sub_chunk_count(const set<int> &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]++;
   }