From: Otto Moerbeek Date: Thu, 19 Jun 2025 08:36:25 +0000 (+0200) Subject: Use std::copy and std::fill, as suggested by rgacogne X-Git-Tag: rec-5.3.0-alpha1^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=18d2ee44cdd886fea11aaffd3a067f71af0f164f;p=thirdparty%2Fpdns.git Use std::copy and std::fill, as suggested by rgacogne Signed-off-by: Otto Moerbeek --- diff --git a/contrib/ProtobufLogger.py b/contrib/ProtobufLogger.py index 56e0e9c22a..c056150c1b 100644 --- a/contrib/ProtobufLogger.py +++ b/contrib/ProtobufLogger.py @@ -390,7 +390,6 @@ class PDNSPBListener(object): if __name__ == "__main__": - print(opentelemetryAvailable) oturl = None if len(sys.argv) == 4: oturl = sys.argv[3] diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index 42b06c30c1..25cf7cb9ad 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -235,12 +235,12 @@ inline void random(SpanID& span) inline void clear(TraceID& trace) { - memset(trace.data(), 0, trace.size()); + trace.fill(0); } inline void clear(SpanID& span) { - memset(span.data(), 0, span.size()); + span.fill(0); } inline void fill(TraceID& trace, const std::string& data) @@ -248,7 +248,7 @@ inline void fill(TraceID& trace, const std::string& data) if (data.size() != trace.size()) { throw std::runtime_error("TraceID size mismatch"); } - memcpy(trace.data(), data.data(), trace.size()); + std::copy(data.begin(), data.end(), trace.begin()); } inline void fill(SpanID& span, const std::string& data) @@ -256,7 +256,7 @@ inline void fill(SpanID& span, const std::string& data) if (data.size() != span.size()) { throw std::runtime_error("SpanID size mismatch"); } - memcpy(span.data(), data.data(), span.size()); + std::copy(data.begin(), data.end(), span.begin()); } inline void fill(TraceID& trace, const char* data, size_t size)