]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/RocksDBStore: always initialize local variable 42474/head
authorKefu Chai <kchai@redhat.com>
Sat, 24 Jul 2021 13:19:26 +0000 (21:19 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 24 Jul 2021 13:31:15 +0000 (21:31 +0800)
silences following warning from GCC:

 ../src/kv/RocksDBStore.cc:386:7: warning: â€˜r’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   386 |       if (r < 0) {
       |       ^~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/kv/RocksDBStore.cc

index 05ad8844cb017a3664910ef8a6762ef124b1bea3..b826bb959d8f018a27d5ded0097623bb7e2091ec 100644 (file)
@@ -363,7 +363,6 @@ int RocksDBStore::ParseOptionsFromStringStatic(
 {
   // keep aligned with func tryInterpret
   const set<string> need_interp_keys = {"compaction_threads", "flusher_threads", "compact_on_mount", "disableWAL"};
-  int r;
   rocksdb::Status status;
   std::unordered_map<std::string, std::string> str_map;
   status = StringToMap(opt_str, &str_map);
@@ -377,6 +376,7 @@ int RocksDBStore::ParseOptionsFromStringStatic(
     string this_opt = it->first + "=" + it->second;
     rocksdb::Status status =
       rocksdb::GetOptionsFromString(opt, this_opt, &opt);
+    int r = 0;
     if (!status.ok()) {
       if (interp != nullptr) {
        r = interp(it->first, it->second, opt);