Skip to content

Commit

Permalink
clang-tidy: use default member init
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Jan 22, 2025
1 parent 34ea1b9 commit 6c0f3bc
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 65 deletions.
6 changes: 3 additions & 3 deletions pdns/axfr-retriever.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ using pdns::resolver::parseResult;

AXFRRetriever::AXFRRetriever(const ComboAddress& remote,
const DNSName& domain,
const TSIGTriplet& tt,
const TSIGTriplet& tt,
const ComboAddress* laddr,
size_t maxReceivedBytes,
uint16_t timeout)
: d_buf(65536), d_tsigVerifier(tt, remote, d_trc), d_receivedBytes(0), d_maxReceivedBytes(maxReceivedBytes)
uint16_t timeout) :
d_buf(65536), d_tsigVerifier(tt, remote, d_trc), d_maxReceivedBytes(maxReceivedBytes)
{
ComboAddress local;
if (laddr != nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion pdns/axfr-retriever.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ class AXFRRetriever : public boost::noncopyable
TSIGRecordContent d_trc;
TSIGTCPVerifier d_tsigVerifier;

size_t d_receivedBytes;
size_t d_receivedBytes{0};
size_t d_maxReceivedBytes;
};
31 changes: 14 additions & 17 deletions pdns/bindparserclasses.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
class BindDomainInfo
{
public:
BindDomainInfo() : hadFileDirective(false), d_dev(0), d_ino(0)
{}

void clear()
{
name=DNSName();
Expand All @@ -50,10 +47,10 @@ public:
vector<ComboAddress> primaries;
set<string> alsoNotify;
string type;
bool hadFileDirective;
dev_t d_dev;
ino_t d_ino;
bool hadFileDirective{false};

dev_t d_dev{0};
ino_t d_ino{0};

bool operator<(const BindDomainInfo& b) const
{
Expand All @@ -66,14 +63,14 @@ extern FILE *yyin;
class BindParser
{
public:
BindParser() : d_dir("."), d_verbose(false)
{
yyin=0;
extern int include_stack_ptr;
include_stack_ptr=0;
bind_directory=d_dir.c_str();
}
BindParser()
{
yyin = 0;
extern int include_stack_ptr;
include_stack_ptr = 0;

bind_directory = d_dir.c_str();
}
~BindParser()
{
if(yyin) {
Expand All @@ -90,9 +87,9 @@ class BindParser
void addAlsoNotify(const string &host);
set<string> & getAlsoNotify() { return this->alsoNotify; }
private:
string d_dir;
string d_dir{"."};
typedef map<DNSName,string> zonedomain_t;
set<string> alsoNotify;
vector<BindDomainInfo> d_zonedomains;
bool d_verbose;
bool d_verbose{false};
};
7 changes: 2 additions & 5 deletions pdns/comment.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@
class Comment
{
public:
Comment() : modified_at(0), domain_id(0) {};
~Comment() = default;

// data
DNSName qname; //!< the name of the associated RRset, for example: www.powerdns.com
time_t modified_at;
time_t modified_at{0};
string account; //!< account last updating this comment
string content; //!< The actual comment. Example: blah blah

int domain_id;
int domain_id{0};
QType qtype; //!< qtype of the associated RRset, ie A, CNAME, MX etc
};
6 changes: 3 additions & 3 deletions pdns/dnswriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
*/


template <typename Container> GenericDNSPacketWriter<Container>::GenericDNSPacketWriter(Container& content, const DNSName& qname, uint16_t qtype, uint16_t qclass, uint8_t opcode)
: d_content(content), d_qname(qname), d_canonic(false), d_lowerCase(false)
template <typename Container>
GenericDNSPacketWriter<Container>::GenericDNSPacketWriter(Container& content, const DNSName& qname, uint16_t qtype, uint16_t qclass, uint8_t opcode) :
d_content(content), d_qname(qname)
{
d_content.clear();
dnsheader dnsheader;
Expand Down
2 changes: 1 addition & 1 deletion pdns/dnswriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private:

uint16_t d_truncatemarker; // end of header, for truncate
DNSResourceRecord::Place d_recordplace;
bool d_canonic, d_lowerCase, d_compress{false};
bool d_canonic{false}, d_lowerCase{false}, d_compress{false};
};

using DNSPacketWriter = GenericDNSPacketWriter<std::vector<uint8_t>>;
Expand Down
7 changes: 4 additions & 3 deletions pdns/inflighter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct TimeTag{};
template<typename Container, typename SenderReceiver> class Inflighter
{
public:
Inflighter(Container& c, SenderReceiver& sr) : d_container(c), d_sr(sr), d_init(false)
Inflighter(Container& c, SenderReceiver& sr) :
d_container(c), d_sr(sr)
{
d_burst = 2;
d_maxInFlight = 5;
Expand Down Expand Up @@ -99,8 +100,8 @@ template<typename Container, typename SenderReceiver> class Inflighter

ttdwatch_t d_ttdWatch;
typename Container::iterator d_iter;
bool d_init;
bool d_init{false};

uint64_t d_unexpectedResponse, d_timeouts;
};

Expand Down
2 changes: 1 addition & 1 deletion pdns/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void Logger::setName(const string& _name)
}

Logger::Logger(string n, int facility) :
name(std::move(n)), flags(LOG_PID | LOG_NDELAY), d_facility(facility), d_loglevel(Logger::None), consoleUrgency(Error), opened(false), d_disableSyslog(false)
name(std::move(n)), flags(LOG_PID | LOG_NDELAY), d_facility(facility)
{
open();
}
Expand Down
13 changes: 5 additions & 8 deletions pdns/logger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,8 @@ public:
private:
struct PerThread
{
PerThread() :
d_urgency(Info)
{}
string d_output;
Urgency d_urgency;
Urgency d_urgency{Info};
};
PerThread& getPerThread();
void open();
Expand All @@ -151,10 +148,10 @@ private:
string name;
int flags;
int d_facility;
Urgency d_loglevel;
Urgency consoleUrgency;
bool opened;
bool d_disableSyslog;
Urgency d_loglevel{Logger::None};
Urgency consoleUrgency{Error};
bool opened{false};
bool d_disableSyslog{false};
bool d_timestamps{true};
bool d_prefixed{false}; // this used to prefix the loglevel, but now causes formatting like structured logging
};
Expand Down
5 changes: 1 addition & 4 deletions pdns/mplexer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ protected:
};

public:
FDMultiplexer() :
d_inrun(false)
{}
virtual ~FDMultiplexer() = default;

// The maximum number of events processed in a single run, not the maximum of watched descriptors
Expand Down Expand Up @@ -296,7 +293,7 @@ protected:
callbackmap_t;

callbackmap_t d_readCallbacks, d_writeCallbacks;
bool d_inrun;
bool d_inrun{false};

void accountingAddFD(callbackmap_t& cbmap, int fd, callbackfunc_t toDo, const funcparam_t& parameter, const struct timeval* ttd)
{
Expand Down
3 changes: 2 additions & 1 deletion pdns/rcpgenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
#include "base64.hh"
#include "namespaces.hh"

RecordTextReader::RecordTextReader(string str, DNSName zone) : d_string(std::move(str)), d_zone(std::move(zone)), d_pos(0)
RecordTextReader::RecordTextReader(string str, DNSName zone) :
d_string(std::move(str)), d_zone(std::move(zone))
{
/* remove whitespace */
if(!d_string.empty() && ( dns_isspace(*d_string.begin()) || dns_isspace(*d_string.rbegin()) ))
Expand Down
2 changes: 1 addition & 1 deletion pdns/rcpgenerator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public:
private:
string d_string;
DNSName d_zone;
string::size_type d_pos;
string::size_type d_pos{0};
string::size_type d_end;
void skipSpaces();
};
Expand Down
5 changes: 2 additions & 3 deletions pdns/signingpipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ catch(...) {
return nullptr;
}

ChunkedSigningPipe::ChunkedSigningPipe(DNSName signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords)
: d_signed(0), d_queued(0), d_outstanding(0), d_numworkers(workers), d_submitted(0), d_signer(std::move(signerName)),
d_maxchunkrecords(maxChunkRecords), d_threads(d_numworkers), d_mustSign(mustSign), d_final(false)
ChunkedSigningPipe::ChunkedSigningPipe(DNSName signerName, bool mustSign, unsigned int workers, unsigned int maxChunkRecords) :
d_signed(0), d_numworkers(workers), d_signer(std::move(signerName)), d_maxchunkrecords(maxChunkRecords), d_threads(d_numworkers), d_mustSign(mustSign)
{
d_rrsetToSign = make_unique<rrset_t>();
d_chunks.push_back(vector<DNSZoneRecord>()); // load an empty chunk
Expand Down
8 changes: 4 additions & 4 deletions pdns/signingpipe.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public:
unsigned int getReady() const;

std::atomic<unsigned long> d_signed;
unsigned int d_queued;
unsigned int d_outstanding;
unsigned int d_queued{0};
unsigned int d_outstanding{0};

private:
void flushToSign();
Expand All @@ -63,7 +63,7 @@ private:
void worker(int fd);

unsigned int d_numworkers;
unsigned int d_submitted;
unsigned int d_submitted{0};

std::unique_ptr<rrset_t> d_rrsetToSign;
std::deque< std::vector<DNSZoneRecord> > d_chunks;
Expand All @@ -77,5 +77,5 @@ private:

vector<std::thread> d_threads;
bool d_mustSign;
bool d_final;
bool d_final{false};
};
4 changes: 2 additions & 2 deletions pdns/webserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ WebServer::WebServer(string listenaddress, int port) :
d_listenaddress(std::move(listenaddress)),
d_port(port),
d_server(nullptr),
d_maxbodysize(2*1024*1024),
d_connectiontimeout(5)
d_maxbodysize(2 * 1024 * 1024)

{
YaHTTP::Router::Map("OPTIONS", "/<*url>", [](YaHTTP::Request *req, YaHTTP::Response *resp) {
// look for url in routes
Expand Down
2 changes: 1 addition & 1 deletion pdns/webserver.hh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ protected:
std::unique_ptr<CredentialsHolder> d_webserverPassword{nullptr};

ssize_t d_maxbodysize; // in bytes
int d_connectiontimeout; // in seconds
int d_connectiontimeout{5}; // in seconds

NetmaskGroup d_acl;

Expand Down
6 changes: 2 additions & 4 deletions pdns/ws-auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ static const std::set<uint16_t> atApexTypes = {QType::SOA, QType::DNSKEY};
static const std::set<uint16_t> nonApexTypes = {QType::DS};

AuthWebServer::AuthWebServer() :
d_start(time(nullptr)),
d_min10(0),
d_min5(0),
d_min1(0)
d_start(time(nullptr))

{
if (arg().mustDo("webserver") || arg().mustDo("api")) {
d_ws = std::make_unique<WebServer>(arg()["webserver-address"], arg().asNum("webserver-port"));
Expand Down
2 changes: 1 addition & 1 deletion pdns/ws-auth.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private:
void statThread(StatBag& stats);

time_t d_start;
double d_min10, d_min5, d_min1;
double d_min10{0}, d_min5{0}, d_min1{0};
Ewma d_queries, d_cachehits, d_cachemisses;
Ewma d_qcachehits, d_qcachemisses;
unique_ptr<WebServer> d_ws{nullptr};
Expand Down
5 changes: 3 additions & 2 deletions pdns/zoneparser-tng.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ private:
unsigned makeTTLFromZone(const std::string& str);

struct filestate {
filestate(FILE* fp, string filename) : d_fp(fp), d_filename(std::move(filename)), d_lineno(0){}
filestate(FILE* fp, string filename) :
d_fp(fp), d_filename(std::move(filename)) {}
FILE *d_fp;
string d_filename;
int d_lineno;
int d_lineno{0};
};

parts_t d_parts;
Expand Down

0 comments on commit 6c0f3bc

Please sign in to comment.