]> granicus.if.org Git - pdns/commitdiff
Revert some changes as suggested by rgacogne
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Tue, 18 Dec 2018 16:18:23 +0000 (17:18 +0100)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Fri, 21 Dec 2018 10:39:01 +0000 (11:39 +0100)
pdns/dnsdist.hh
pdns/histog.hh
pdns/lazy_allocator.hh
pdns/rcpgenerator.cc
pdns/sillyrecords.cc
pdns/ssqlite3.cc
pdns/syncres.hh

index 0be157419bca167882c7d5bddb5fffef1786089d..914fa7440f88aa126a2e4cf4fe2c8d44cbf95b4a 100644 (file)
@@ -283,7 +283,7 @@ enum class PrometheusMetricType: int {
 
 // Keeps additional information about metrics
 struct MetricDefinition {
-  MetricDefinition(PrometheusMetricType prometheusType, const std::string& description): description(description), prometheusType(prometheusType) {
+  MetricDefinition(PrometheusMetricType _prometheusType, const std::string& _description): description(_description), prometheusType(_prometheusType) {
   }
  
   MetricDefinition() = default;
index 62df2a8fe1d72bc965c504274ff3a78e8691ab68..f96e4beab0fd280084ff56517b47862d427ebfd4 100644 (file)
@@ -21,7 +21,7 @@ struct LogHistogramBin
 
 template<typename T>
 std::vector<LogHistogramBin> createLogHistogram(const T& bins,
-                        std::deque<double>& percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999})
+                        std::deque<double> percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999})
 {
   uint64_t totcumul=0, sum=0;
 
@@ -60,7 +60,7 @@ std::vector<LogHistogramBin> createLogHistogram(const T& bins,
 }
 
 template<typename T>
-void writeLogHistogramFile(const T& bins, std::ostream& out, std::deque<double>& percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999} )
+void writeLogHistogramFile(const T& bins, std::ostream& out, std::deque<double> percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999} )
 {
 
   auto vec = createLogHistogram(bins, percentiles);
index 17ef07aa6749072986eeddc6044a85eb226fa2d2..1b9308851a449b275e1f696fa884af8c3b7df0f8 100644 (file)
@@ -35,12 +35,12 @@ struct lazy_allocator {
                    "lazy_allocator must only be used with trivial types");
 
     pointer
-    allocate (size_type const& n) {
+    allocate (size_type const n) {
         return static_cast<pointer>(::operator new (n * sizeof(value_type)));
     }
 
     void
-    deallocate (pointer const ptr, size_type const& n) noexcept {
+    deallocate (pointer const ptr, size_type const n) noexcept {
 #if defined(__cpp_sized_deallocation) &&  (__cpp_sized_deallocation >= 201309)
         ::operator delete (ptr, n * sizeof(value_type));
 #else
index a21d1ab872e28dc41f4424b93b2e5ebabcbac455..a7f9c364b07de797c4d09eed7ffaddf59d270c66 100644 (file)
@@ -545,7 +545,8 @@ void RecordTextWriter::xfrTime(const uint32_t& val)
   time_t time=val; // Y2038 bug!
   gmtime_r(&time, &tm);
 
-  d_string += boost::str(boost::format("%04d%02d%02d" "%02d%02d%02d") % (tm.tm_year+1900) % (tm.tm_mon+1) % tm.tm_mday % tm.tm_hour % tm.tm_min % tm.tm_sec);
+  static const boost::format fmt("%04d%02d%02d" "%02d%02d%02d");
+  d_string += boost::str(boost::format(fmt) % (tm.tm_year+1900) % (tm.tm_mon+1) % tm.tm_mday % tm.tm_hour % tm.tm_min % tm.tm_sec);
 }
 
 
index 5b5d38a25bf07ec4e5e45ac6ba731f4ea90cb1b5..334e3e19900afefe1c68a366f144c56fc19142d7 100644 (file)
@@ -319,8 +319,9 @@ string LOCRecordContent::getZoneRepresentation(bool noDot) const
 
   double remlat=60.0*(latitude-(int)latitude);
   double remlong=60.0*(longitude-(int)longitude);
+  static const boost::format fmt("%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm");
   std::string ret = boost::str(
-    boost::format("%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm")
+    boost::format(fmt)
     % abs((int)latitude) % abs((int) ((latitude-(int)latitude)*60))
     % fabs((double)((remlat-(int)remlat)*60.0)) % (latitude>0 ? 'N' : 'S')
     % abs((int)longitude) % abs((int) ((longitude-(int)longitude)*60))
index 860d25452c937370daef0f53686f57bff31ab260..c5f86f67c2d04fe1a5149b524c5985b9f090dcb5 100644 (file)
@@ -53,7 +53,7 @@ public:
     d_prepared(false),
     d_query(query),
     d_dolog(dolog),
-    d_stmt(NULL),
+    d_stmt(nullptr),
     d_rc(0),
     d_db(db)
   {
index d9bbebf0695ba22a88a40487ccb9d7279a0b63ac..106320e8e2874e41b608f2b8178c282e987347f9 100644 (file)
@@ -72,7 +72,7 @@ typedef map<
 template<class Thing> class Throttle : public boost::noncopyable
 {
 public:
-  Throttle() : d_limit(3), d_ttl(60), d_last_clean(time(0))
+  Throttle() : d_limit(3), d_ttl(60), d_last_clean(time(nullptr))
   {
   }