From 56e646f55db6e66f9381b75fe638b45cbeaf5d09 Mon Sep 17 00:00:00 2001 From: Ralph Covelli Date: Fri, 12 May 2017 04:40:14 +0100 Subject: [PATCH] Refactored some redundant loops in CommunicatorClass::go() --- pdns/communicator.cc | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/pdns/communicator.cc b/pdns/communicator.cc index eff4f2bb74..6958a8ef3a 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -37,6 +37,21 @@ #include "arguments.hh" #include "packetcache.hh" +#define CommunicatorLoadArgsIntoSet(listname,listset) do { \ + vector parts; \ + stringtok(parts, ::arg()[(listname)], ", \t"); \ + for (vector::const_iterator iter = parts.begin(); iter != parts.end(); ++iter) { \ + try { \ + ComboAddress caIp(*iter, 53); \ + (listset).insert(caIp.toStringWithPort()); \ + } \ + catch(PDNSException &e) { \ + L< parts; - stringtok(parts, ::arg()["also-notify"], ", \t"); - for (vector::const_iterator iter = parts.begin(); iter != parts.end(); ++iter) { - try { - ComboAddress caIp(*iter, 53); - d_alsoNotify.insert(caIp.toStringWithPort()); - } - catch(PDNSException &e) { - L< forwards; - stringtok(forwards, ::arg()["forward-notify"], ", \t"); - for (vector::const_iterator iter = forwards.begin(); iter != forwards.end(); ++iter) { - try { - ComboAddress caIp(*iter, 53); - PacketHandler::s_forwardNotify.insert(caIp.toStringWithPort()); - } - catch(PDNSException &e) { - L<