From: Ensar Sarajčić Date: Thu, 12 Dec 2024 15:36:54 +0000 (+0100) Subject: dnsdist: remove unnecessary optional around variant opts X-Git-Tag: dnsdist-2.0.0-alpha0^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d075382ad52b6c4e784b9c0c398c164d1482655;p=thirdparty%2Fpdns.git dnsdist: remove unnecessary optional around variant opts --- diff --git a/pdns/dnsdistdist/dnsdist-lua.cc b/pdns/dnsdistdist/dnsdist-lua.cc index 7da861d9db..1e432d31b0 100644 --- a/pdns/dnsdistdist/dnsdist-lua.cc +++ b/pdns/dnsdistdist/dnsdist-lua.cc @@ -3412,7 +3412,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) newThread.detach(); }); - luaCtx.writeFunction("declareMetric", [](const std::string& name, const std::string& type, const std::string& description, boost::optional>> opts) { + luaCtx.writeFunction("declareMetric", [](const std::string& name, const std::string& type, const std::string& description, boost::optional> opts) { bool withLabels = false; std::optional customName = std::nullopt; if (opts) { @@ -3421,7 +3421,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) customName = std::optional(*optCustomName); } if (!customName) { - boost::optional vars = boost::get>(opts.get()); + boost::optional vars = {boost::get(opts.get())}; getOptionalValue(vars, "customName", customName); getOptionalValue(vars, "withLabels", withLabels); checkAllParametersConsumed("declareMetric", vars); @@ -3435,7 +3435,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } return true; }); - luaCtx.writeFunction("incMetric", [](const std::string& name, boost::optional>> opts) { + luaCtx.writeFunction("incMetric", [](const std::string& name, boost::optional> opts) { auto incOpts = opts.get_value_or(1); uint64_t step = 1; std::unordered_map labels; @@ -3443,7 +3443,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) step = *custom_step; } else { - boost::optional vars = boost::get>(incOpts); + boost::optional vars = {boost::get(incOpts)}; getOptionalValue(vars, "step", step); getOptionalValue>(vars, "labels", labels); checkAllParametersConsumed("incMetric", vars); @@ -3456,7 +3456,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } return std::get(result); }); - luaCtx.writeFunction("decMetric", [](const std::string& name, boost::optional>> opts) { + luaCtx.writeFunction("decMetric", [](const std::string& name, boost::optional> opts) { auto decOpts = opts.get_value_or(1); uint64_t step = 1; std::unordered_map labels; @@ -3464,7 +3464,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) step = *custom_step; } else { - boost::optional vars = boost::get>(decOpts); + boost::optional vars = {boost::get(decOpts)}; getOptionalValue(vars, "step", step); getOptionalValue>(vars, "labels", labels); checkAllParametersConsumed("decMetric", vars);