]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Get rid of warnings when compiling with Boost 1.74 10222/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 11 Dec 2020 16:01:00 +0000 (17:01 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 26 Mar 2021 08:15:16 +0000 (09:15 +0100)
(cherry picked from commit b2dd79dc04e2939fb84e3a4ee3df9a191bebe529)

pdns/rec_channel_rec.cc
pdns/test-dnsname_cc.cc

index 898da4268946d91fec2095f061f24ed889e2b89f..d5b82f8dfdbdc7d4865cd456335e61437fd51a71 100644 (file)
@@ -3,7 +3,7 @@
 #endif
 #include "utility.hh"
 #include "rec_channel.hh"
-#include <boost/bind.hpp>
+
 #include <vector>
 #ifdef MALLOC_TRACE
 #include "malloctrace.hh"
@@ -1175,26 +1175,27 @@ void registerAllStats()
   addGetStat("noedns-outqueries", &g_stats.noEdnsOutQueries);
 
   addGetStat("uptime", calculateUptime);
-  addGetStat("real-memory-usage", boost::bind(getRealMemoryUsage, string()));
-  addGetStat("special-memory-usage", boost::bind(getSpecialMemoryUsage, string()));
-  addGetStat("fd-usage", boost::bind(getOpenFileDescriptors, string()));
+  addGetStat("real-memory-usage", []{ return getRealMemoryUsage(string()); });
+  addGetStat("special-memory-usage", []{ return getSpecialMemoryUsage(string()); });
+  addGetStat("fd-usage", []{ return getOpenFileDescriptors(string()); });
 
   //  addGetStat("query-rate", getQueryRate);
   addGetStat("user-msec", getUserTimeMsec);
   addGetStat("sys-msec", getSysTimeMsec);
 
 #ifdef __linux__
-  addGetStat("cpu-iowait", boost::bind(getCPUIOWait, string()));
-  addGetStat("cpu-steal", boost::bind(getCPUSteal, string()));
+  addGetStat("cpu-iowait", []{ return getCPUIOWait(string()); });
+  addGetStat("cpu-steal", []{ return getCPUSteal(string()); });
 #endif
 
-  for(unsigned int n=0; n < g_numThreads; ++n)
-    addGetStat("cpu-msec-thread-"+std::to_string(n), boost::bind(&doGetThreadCPUMsec, n));
+  for (unsigned int n = 0; n < g_numThreads; ++n) {
+    addGetStat("cpu-msec-thread-"+std::to_string(n), [n]{ return doGetThreadCPUMsec(n);});
+  }
 
 #ifdef MALLOC_TRACE
-  addGetStat("memory-allocs", boost::bind(&MallocTracer::getAllocs, g_mtracer, string()));
-  addGetStat("memory-alloc-flux", boost::bind(&MallocTracer::getAllocFlux, g_mtracer, string()));
-  addGetStat("memory-allocated", boost::bind(&MallocTracer::getTotAllocated, g_mtracer, string()));
+  addGetStat("memory-allocs", []{ return g_mtracer->getAllocs(string()); });
+  addGetStat("memory-alloc-flux", []{ return g_mtracer->getAllocFlux(string()); });
+  addGetStat("memory-allocated", []{ return g_mtracer->getTotAllocated(string()); });
 #endif
 
   addGetStat("dnssec-validations", &g_stats.dnssecValidations);
index 9c1890de8a2be1495511b4c030b0a5c974bfa01d..8b8cf8b461eacf655323f6f82b95e7e56b4fb4c8 100644 (file)
@@ -1,14 +1,16 @@
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_NO_MAIN
 #include <boost/test/unit_test.hpp>
-#include <boost/assign/std/map.hpp>
+
+#include <cmath>
 #include <numeric>
-#include <math.h>
+#include <unordered_set>
+
 #include "dnsname.hh"
 #include "misc.hh"
 #include "dnswriter.hh"
 #include "dnsrecords.hh"
-#include <unordered_set>
+
 using namespace boost;
 using std::string;