From: Remi Gacogne Date: Tue, 14 Apr 2026 09:13:58 +0000 (+0200) Subject: dnsdist: Silence performance warnings from Coverity X-Git-Tag: auth-5.1.0-beta1~57^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3864fbaf8c951fc1e6195d0cbae27f58f7a7c723;p=thirdparty%2Fpdns.git dnsdist: Silence performance warnings from Coverity Coverity (CID 503155 and 503156, at least) is worried that we are mistakenly duplicating the `std::string`s that our Lua bindings are returning. We are doing it on purpose, so let's make it clear. Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc index 4781d03be3..fcbccf7f46 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-dnsquestion.cc @@ -195,14 +195,14 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return true; }); }); - luaCtx.registerFunction("getTrailingData", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getTrailingData", [](const DNSQuestion& dnsQuestion) -> std::string { return dnsQuestion.getTrailingData(); }); luaCtx.registerFunction("setTrailingData", [](DNSQuestion& dnsQuestion, const std::string& tail) { return dnsQuestion.setTrailingData(tail); }); - luaCtx.registerFunction("getServerNameIndication", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getServerNameIndication", [](const DNSQuestion& dnsQuestion) -> std::string { return dnsQuestion.sni; }); @@ -553,7 +553,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return true; }); }); - luaCtx.registerFunction("getTrailingData", [](const DNSResponse& dnsQuestion) { + luaCtx.registerFunction("getTrailingData", [](const DNSResponse& dnsQuestion) -> std::string { return dnsQuestion.getTrailingData(); }); luaCtx.registerFunction("setTrailingData", [](DNSResponse& dnsQuestion, const std::string& tail) { @@ -573,7 +573,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) dnsResponse.setTag(tag.first, tag.second); } }); - luaCtx.registerFunction("getTag", [](const DNSResponse& dnsResponse, const std::string& strLabel) { + luaCtx.registerFunction("getTag", [](const DNSResponse& dnsResponse, const std::string& strLabel) -> std::string { auto value = dnsResponse.getTag(strLabel); if (!value) { return string(); @@ -589,7 +589,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return *dnsResponse.ids.qTag; }); - luaCtx.registerFunction("getProtocol", [](const DNSResponse& dnsResponse) { + luaCtx.registerFunction("getProtocol", [](const DNSResponse& dnsResponse) -> std::string { return dnsResponse.getProtocol().toPrettyString(); }); @@ -617,7 +617,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) }); #if defined(HAVE_DNS_OVER_HTTPS) || defined(HAVE_DNS_OVER_HTTP3) - luaCtx.registerFunction("getHTTPPath", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getHTTPPath", [](const DNSQuestion& dnsQuestion) -> std::string { #if defined(HAVE_DNS_OVER_HTTPS) if (dnsQuestion.ids.du) { return dnsQuestion.ids.du->getHTTPPath(); @@ -631,7 +631,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return std::string(); }); - luaCtx.registerFunction("getHTTPQueryString", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getHTTPQueryString", [](const DNSQuestion& dnsQuestion) -> std::string { #if defined(HAVE_DNS_OVER_HTTPS) if (dnsQuestion.ids.du) { return dnsQuestion.ids.du->getHTTPQueryString(); @@ -645,7 +645,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return std::string(); }); - luaCtx.registerFunction("getHTTPHost", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getHTTPHost", [](const DNSQuestion& dnsQuestion) -> std::string { #if defined(HAVE_DNS_OVER_HTTPS) if (dnsQuestion.ids.du) { return dnsQuestion.ids.du->getHTTPHost(); @@ -659,7 +659,7 @@ void setupLuaBindingsDNSQuestion([[maybe_unused]] LuaContext& luaCtx) return std::string(); }); - luaCtx.registerFunction("getHTTPScheme", [](const DNSQuestion& dnsQuestion) { + luaCtx.registerFunction("getHTTPScheme", [](const DNSQuestion& dnsQuestion) -> std::string { #if defined(HAVE_DNS_OVER_HTTPS) if (dnsQuestion.ids.du) { return dnsQuestion.ids.du->getHTTPScheme();