From 4778cfd22a0ff0be920813848bab718c19f1c8e0 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 29 Aug 2019 11:48:26 +0200 Subject: [PATCH] dnsdist: Fix KVS compilation on Boost < 1.56 When neither the C++ 17 nor Boost >= 1.61 string_view are available, we fall back to boost::string_ref. Unfortunately it didn't have the to_string() method before 1.56. Since we end up converting it to a string anyway, let's just skip the string_view/string_ref part. --- pdns/dnsdistdist/dnsdist-kvs.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pdns/dnsdistdist/dnsdist-kvs.cc b/pdns/dnsdistdist/dnsdist-kvs.cc index 814551bfec..a99047ffaa 100644 --- a/pdns/dnsdistdist/dnsdist-kvs.cc +++ b/pdns/dnsdistdist/dnsdist-kvs.cc @@ -72,13 +72,13 @@ std::vector KeyValueLookupKeySuffix::getKeys(const DNSName& qname) bool LMDBKVStore::getValue(const std::string& key, std::string& value) { - string_view result; try { auto transaction = d_env.getROTransaction(); auto dbi = transaction.openDB(d_dbName, 0); + MDBOutVal result; int rc = transaction.get(dbi, MDBInVal(key), result); if (rc == 0) { - value = result.to_string(); + value = result.get(); return true; } else if (rc == MDB_NOTFOUND) { @@ -93,10 +93,10 @@ bool LMDBKVStore::getValue(const std::string& key, std::string& value) bool LMDBKVStore::keyExists(const std::string& key) { - string_view result; try { auto transaction = d_env.getROTransaction(); auto dbi = transaction.openDB(d_dbName, 0); + MDBOutVal result; int rc = transaction.get(dbi, MDBInVal(key), result); if (rc == 0) { return true; -- 2.47.2