This brings a small speed-up when the proxy protocol ACL is empty,
for example.
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
//<! Returns "best match" for key_type, which might not be value
[[nodiscard]] node_type* lookup(const key_type& value) const
{
+ if (empty()) {
+ return nullptr;
+ }
uint8_t max_bits = value.getBits();
return lookupImpl(value, max_bits);
}
//<! Perform best match lookup for value, using at most max_bits
[[nodiscard]] node_type* lookup(const ComboAddress& value, int max_bits = 128) const
{
+ if (empty()) {
+ return nullptr;
+ }
uint8_t addr_bits = value.getBits();
if (max_bits < 0 || max_bits > addr_bits) {
max_bits = addr_bits;