From 3eba27418a7102a82777b74bd199943b67a93a6e Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 19 Nov 2019 10:03:17 +0100 Subject: [PATCH] Avoid looking up an entry twice by using a ref. --- pdns/syncres.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 1270452109..0336870c0e 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -239,8 +239,9 @@ public: typename cont_t::iterator i = d_cont.find(t); if (i == d_cont.end()) { - d_cont[t].value = 1; - d_cont[t].last = now.tv_sec; + auto &r = d_cont[t]; + r.value = 1; + r.last = now.tv_sec; return 1; } else { -- 2.47.2