Skip to content

Commit

Permalink
dnsdist: revert some clang-tidy related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chbruyand committed Jan 18, 2024
1 parent 655fe34 commit 42225bb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
24 changes: 16 additions & 8 deletions pdns/dnsdist-lua-actions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,10 @@ class PoolAction : public DNSAction
}

private:
std::string d_pool;
bool d_stopProcessing;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::string d_pool;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const bool d_stopProcessing;
};

class QPSPoolAction : public DNSAction
Expand All @@ -355,8 +357,10 @@ class QPSPoolAction : public DNSAction

private:
mutable LockGuarded<QPSLimiter> d_qps;
std::string d_pool;
bool d_stopProcessing;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::string d_pool;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const bool d_stopProcessing;
};

class RCodeAction : public DNSAction
Expand Down Expand Up @@ -747,8 +751,10 @@ class LuaFFIPerThreadAction : public DNSAction
};
static std::atomic<uint64_t> s_functionsCounter;
static thread_local std::map<uint64_t, PerThreadState> t_perThreadStates;
std::string d_functionCode;
uint64_t d_functionID;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::string d_functionCode;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const uint64_t d_functionID;
};

std::atomic<uint64_t> LuaFFIPerThreadAction::s_functionsCounter = 0;
Expand Down Expand Up @@ -869,8 +875,10 @@ class LuaFFIPerThreadResponseAction : public DNSResponseAction

static std::atomic<uint64_t> s_functionsCounter;
static thread_local std::map<uint64_t, PerThreadState> t_perThreadStates;
std::string d_functionCode;
uint64_t d_functionID;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::string d_functionCode;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const uint64_t d_functionID;
};

std::atomic<uint64_t> LuaFFIPerThreadResponseAction::s_functionsCounter = 0;
Expand Down
10 changes: 6 additions & 4 deletions pdns/dnsdist-protobuf.hh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ private:
};
std::unordered_map<std::string, MetaValue> d_metaTags;

// FIXME wondering if the cost of moving to a shared_ptr would be that bad
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const DNSQuestion& d_dq;
const DNSResponse* d_dr{nullptr};
Expand Down Expand Up @@ -127,9 +126,12 @@ class ProtoBufMetaKey

struct KeyTypeDescription
{
std::string d_name;
Type d_type;
std::function<std::vector<std::string>(const DNSQuestion&, const std::string&, uint8_t)> d_func;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::string d_name;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const Type d_type;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const std::function<std::vector<std::string>(const DNSQuestion&, const std::string&, uint8_t)> d_func;
bool d_prefix{false};
bool d_caseSensitive{true};
bool d_numeric{false};
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ DNSName::DNSName(const std::string_view sw)
}


DNSName::DNSName(const char* pos, size_t len, size_t offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, uint16_t minOffset)
DNSName::DNSName(const char* pos, int len, int offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, uint16_t minOffset)
{
if (offset >= len)
throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsname.hh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public:
DNSName(DNSName&& a) = default;

explicit DNSName(std::string_view sw); //!< Constructs from a human formatted, escaped presentation
DNSName(const char* pos, size_t len, size_t offset, bool uncompress, uint16_t* qtype = nullptr, uint16_t* qclass = nullptr, unsigned int* consumed = nullptr, uint16_t minOffset = 0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.
DNSName(const char* p, int len, int offset, bool uncompress, uint16_t* qtype = nullptr, uint16_t* qclass = nullptr, unsigned int* consumed = nullptr, uint16_t minOffset = 0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.

bool isPartOf(const DNSName& rhs) const; //!< Are we part of the rhs name? Note that name.isPartOf(name).
inline bool operator==(const DNSName& rhs) const; //!< DNS-native comparison (case insensitive) - empty compares to empty
Expand Down

0 comments on commit 42225bb

Please sign in to comment.