From: Pieter Lexis Date: Thu, 25 Sep 2025 15:48:14 +0000 (+0200) Subject: chore: keep SpanID and TraceID together in the file X-Git-Tag: rec-5.4.0-alpha1~187^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a56917edb3b81db1fcd8ec3ff009b32b3065b65f;p=thirdparty%2Fpdns.git chore: keep SpanID and TraceID together in the file --- diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index 3ba88ccf04..402d2803fd 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -236,6 +236,15 @@ struct TraceID : public std::array return ostrm << val.toLogString(); } }; +constexpr TraceID s_emptyTraceID = {}; +inline void random(TraceID& trace) +{ + dns_random(trace.data(), trace.size()); +} +inline void clear(TraceID& trace) +{ + trace.fill(0); +} struct SpanID : public std::array { @@ -245,19 +254,15 @@ struct SpanID : public std::array return ostrm << val.toLogString(); } }; - -constexpr TraceID s_emptyTraceID = {}; - -inline void random(TraceID& trace) -{ - dns_random(trace.data(), trace.size()); -} - +constexpr SpanID s_emptySpanID = {}; inline void random(SpanID& span) { dns_random(span.data(), span.size()); } - +inline void clear(SpanID& span) +{ + span.fill(0); +} inline SpanID randomSpanID() { SpanID ret; @@ -265,16 +270,6 @@ inline SpanID randomSpanID() return ret; } -inline void clear(TraceID& trace) -{ - trace.fill(0); -} - -inline void clear(SpanID& span) -{ - span.fill(0); -} - inline void fill(TraceID& trace, const std::string& data) { if (data.size() != trace.size()) {