]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use emplace instead of insert
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 29 Apr 2022 15:16:11 +0000 (17:16 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 29 Apr 2022 15:16:11 +0000 (17:16 +0200)
pdns/syncres.cc

index d8773c1ff4fc45d3c8c38de70e8b0f385f06c37d..5b6ccec2ff54733bded8baa023a7db3d1e11a93b 100644 (file)
@@ -237,6 +237,9 @@ public:
 
   struct entry_t
   {
+    entry_t(const Thing& thing_, time_t ttd_, unsigned int count_) : thing(thing_), ttd(ttd_), count(count_)
+    {
+    }
     Thing thing;
     time_t ttd;
     mutable unsigned int count;
@@ -267,8 +270,7 @@ public:
     auto i = d_cont.find(t);
     time_t ttd = now + ttl;
     if (i == d_cont.end()) {
-      entry_t e = { t, ttd, count };
-      d_cont.insert(e);
+      d_cont.emplace(t, ttd, count);
     } else if (ttd > i->ttd || count > i->count) {
       ttd = std::max(i->ttd, ttd);
       count = std::max(i->count, count);