]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: a few minor Coverity cases in the new OpenTelemetry trace code
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 25 Jun 2025 07:15:51 +0000 (09:15 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 1 Jul 2025 07:29:17 +0000 (09:29 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/protozero-trace.hh
pdns/recursordist/rec-eventtrace.cc

index 36fcaad53a65c0b0e01d305e4c637bcd6dc4106e..c07acc6ac740bdc673cd1dff15e375c5591790d8 100644 (file)
@@ -134,7 +134,7 @@ T decode(protozero::pbf_reader& reader)
       vec.emplace_back(E::decode(sub));
     }
   }
-  return {vec};
+  return {std::move(vec)};
 }
 
 struct ArrayValue
index 52c9fe760117373bf144f3e3212e0406556c259e..360ad29e3dd986ab31ba671c60498793fa47fa22 100644 (file)
@@ -49,18 +49,18 @@ static void addValue(const RecEventTrace::Entry& event, Span& work, bool start)
   if (std::holds_alternative<std::nullopt_t>(event.d_value)) {
     return;
   }
-  const string key = start ? "arg" : "result";
+  string key = start ? "arg" : "result";
   if (std::holds_alternative<bool>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{key, {std::get<bool>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{std::move(key), {std::get<bool>(event.d_value)}});
   }
   else if (std::holds_alternative<int64_t>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{key, {std::get<int64_t>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{std::move(key), {std::get<int64_t>(event.d_value)}});
   }
   else if (std::holds_alternative<std::string>(event.d_value)) {
-    work.attributes.emplace_back(KeyValue{key, {std::get<std::string>(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{std::move(key), {std::get<std::string>(event.d_value)}});
   }
   else {
-    work.attributes.emplace_back(KeyValue{key, {RecEventTrace::toString(event.d_value)}});
+    work.attributes.emplace_back(KeyValue{std::move(key), {RecEventTrace::toString(event.d_value)}});
   }
 }