]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid two cases of too early instantation of a member of a vector of an incomplete...
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 4 Sep 2025 07:46:58 +0000 (09:46 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 12 Nov 2025 08:09:27 +0000 (09:09 +0100)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/protozero-trace.hh

index 23039fa7bbc4bea6b9de1443fd2c9de6285d9753..08515b87a3e6c8f7c5fac244a99825adf46e52a3 100644 (file)
@@ -140,7 +140,7 @@ T decode(protozero::pbf_reader& reader)
 
 struct ArrayValue
 {
-  std::vector<AnyValue> values{}; // = 1
+  std::vector<AnyValue> values; // = 1
 
   void encode(protozero::pbf_writer& writer) const
   {
@@ -149,15 +149,12 @@ struct ArrayValue
 
   static ArrayValue decode(protozero::pbf_reader& reader);
 
-  bool operator==(const ArrayValue& rhs) const
-  {
-    return values == rhs.values;
-  }
+  bool operator==(const ArrayValue& rhs) const;
 };
 
 struct KeyValueList
 {
-  std::vector<KeyValue> values{}; // = 1
+  std::vector<KeyValue> values; // = 1
 
   void encode(protozero::pbf_writer& writer) const
   {
@@ -166,10 +163,7 @@ struct KeyValueList
 
   static KeyValueList decode(protozero::pbf_reader& reader);
 
-  bool operator==(const KeyValueList& rhs) const
-  {
-    return values == rhs.values;
-  }
+  bool operator==(const KeyValueList& rhs) const;
 };
 
 using NoValue = char;
@@ -202,10 +196,7 @@ struct KeyValue
   void encode(protozero::pbf_writer& writer) const;
   static KeyValue decode(protozero::pbf_reader& reader);
 
-  bool operator==(const KeyValue& rhs) const
-  {
-    return key == rhs.key && value == rhs.value;
-  }
+  bool operator==(const KeyValue& rhs) const;
 };
 
 struct Resource
@@ -821,4 +812,19 @@ private:
 void extractOTraceIDs(const EDNSOptionViewMap& map, pdns::trace::InitialSpanInfo& span);
 bool extractOTraceIDs(const EDNSOptionViewMap& map, const EDNSOptionCode::EDNSOptionCodeEnum& eoc, pdns::trace::TraceID& traceID, pdns::trace::SpanID& spanID);
 
+inline bool ArrayValue::operator==(const ArrayValue& rhs) const
+{
+  return values == rhs.values;
+}
+
+inline bool KeyValueList::operator==(const KeyValueList& rhs) const
+{
+  return values == rhs.values;
+}
+
+inline bool KeyValue::operator==(const KeyValue& rhs) const
+{
+  return key == rhs.key && value == rhs.value;
+}
+
 } // namespace pdns::trace