From: Otto Moerbeek Date: Thu, 4 Sep 2025 07:46:58 +0000 (+0200) Subject: Avoid two cases of too early instantation of a member of a vector of an incomplete... X-Git-Tag: rec-5.4.0-alpha1~100^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86d1fb4ba450f13ebe455adb18780004f92606d4;p=thirdparty%2Fpdns.git Avoid two cases of too early instantation of a member of a vector of an incomplete class Signed-off-by: Otto Moerbeek --- diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index 23039fa7bb..08515b87a3 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -140,7 +140,7 @@ T decode(protozero::pbf_reader& reader) struct ArrayValue { - std::vector values{}; // = 1 + std::vector 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 values{}; // = 1 + std::vector 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