]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use std::copy and std::fill, as suggested by rgacogne
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 19 Jun 2025 08:36:25 +0000 (10:36 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 19 Jun 2025 08:36:51 +0000 (10:36 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
contrib/ProtobufLogger.py
pdns/protozero-trace.hh

index 56e0e9c22a6fd0adcac73e0dc3c11e8c636a0ce1..c056150c1bc2cb9447d372723f181783da69756b 100644 (file)
@@ -390,7 +390,6 @@ class PDNSPBListener(object):
 
 
 if __name__ == "__main__":
-    print(opentelemetryAvailable)
     oturl = None
     if len(sys.argv) == 4:
         oturl = sys.argv[3]
index 42b06c30c1851e07bb30cc06d161d1873709de7d..25cf7cb9add53963545b0d2797671cd90462c7c2 100644 (file)
@@ -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)