From: bert hubert Date: Fri, 2 Jan 2015 21:40:59 +0000 (+0100) Subject: work around a boost issue with circular buffer or map of unions, most evident on... X-Git-Tag: rec-3.7.0-rc1~67^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=662d5441b0b8e346d27b188ff220955fec6392cb;p=pdns work around a boost issue with circular buffer or map of unions, most evident on freebsd 9 and 10 --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index c7e081488..523044353 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -80,7 +80,7 @@ union ComboAddress { return memcmp(&sin6.sin6_addr.s6_addr, &rhs.sin6.sin6_addr.s6_addr, 16) > 0; } - struct addressOnlyLessThan: public std::binary_function + struct addressOnlyLessThan: public std::binary_function { bool operator()(const ComboAddress& a, const ComboAddress& b) const { diff --git a/pdns/statbag.cc b/pdns/statbag.cc index 7d352167e..188e71b3a 100644 --- a/pdns/statbag.cc +++ b/pdns/statbag.cc @@ -229,7 +229,7 @@ void StatBag::declareRing(const string &name, const string &help, unsigned int s void StatBag::declareComboRing(const string &name, const string &help, unsigned int size) { - d_comborings[name]=StatRing(size); + d_comborings[name]=StatRing(size); d_comborings[name].setHelp(help); } @@ -239,11 +239,11 @@ vector > StatBag::getRing(const string &name) if(d_rings.count(name)) return d_rings[name].get(); else { - typedef pair stor_t; + typedef pair stor_t; vector raw =d_comborings[name].get(); vector > ret; BOOST_FOREACH(const stor_t& stor, raw) { - ret.push_back(make_pair(stor.first.toString(), stor.second)); + ret.push_back(make_pair(stor.first.ca.toString(), stor.second)); } return ret; } @@ -295,7 +295,7 @@ vectorStatBag::listRings() vector ret; for(map >::const_iterator i=d_rings.begin();i!=d_rings.end();++i) ret.push_back(i->first); - for(map >::const_iterator i=d_comborings.begin();i!=d_comborings.end();++i) + for(map >::const_iterator i=d_comborings.begin();i!=d_comborings.end();++i) ret.push_back(i->first); return ret; @@ -307,4 +307,4 @@ bool StatBag::ringExists(const string &name) } template class StatRing; -template class StatRing; +template class StatRing; diff --git a/pdns/statbag.hh b/pdns/statbag.hh index a175588a0..ae260f59e 100644 --- a/pdns/statbag.hh +++ b/pdns/statbag.hh @@ -31,6 +31,17 @@ #include "iputils.hh" #include +struct SComboAddress +{ + SComboAddress(const ComboAddress& orig) : ca(orig) {} + ComboAddress ca; + bool operator<(const SComboAddress& rhs) const + { + return ComboAddress::addressOnlyLessThan()(ca, rhs.ca); + } +}; + + template > class StatRing { @@ -63,7 +74,7 @@ class StatBag map d_stats; map d_keyDescrips; map >d_rings; - map >d_comborings; + map >d_comborings; typedef boost::function func_t; typedef map funcstats_t; funcstats_t d_funcstats;