summaryrefslogtreecommitdiff
path: root/include/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2022-01-03 18:34:16 +0000
committerSadie Powell <sadie@witchery.services>2022-01-04 00:17:13 +0000
commit7531e90499d4cd60b6464c692725225e85c00738 (patch)
tree930fd946ea495b74c4071a67e12cadb700ab79ab /include/modules
parentdfcc025a19d7d49179d75f34553c36e0d47eaded (diff)
Use C++11 style class/struct initialisation.
Diffstat (limited to 'include/modules')
-rw-r--r--include/modules/dns.h16
-rw-r--r--include/modules/httpd.h6
-rw-r--r--include/modules/os_forbid.h6
-rw-r--r--include/modules/os_ignore.h4
-rw-r--r--include/modules/os_session.h6
-rw-r--r--include/modules/sql.h4
6 files changed, 21 insertions, 21 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 1fe642c3b..afbac2944 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -73,10 +73,10 @@ namespace DNS
struct Question
{
Anope::string name;
- QueryType type;
- unsigned short qclass;
+ QueryType type = QUERY_NONE;
+ unsigned short qclass = 0;
- Question() : type(QUERY_NONE), qclass(0) { }
+ Question() = default;
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { }
inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
@@ -91,12 +91,12 @@ namespace DNS
struct ResourceRecord : Question
{
- unsigned int ttl;
+ unsigned int ttl = 0;
Anope::string rdata;
time_t created;
- ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
- ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
+ ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { }
+ ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { }
};
struct Query
@@ -139,12 +139,12 @@ namespace DNS
/* Use result cache if available */
bool use_cache;
/* Request id */
- unsigned short id;
+ unsigned short id = 0;
/* Creator of this request */
Module *creator;
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
- use_cache(cache), id(0), creator(c) { }
+ use_cache(cache), creator(c) { }
virtual ~Request()
{
diff --git a/include/modules/httpd.h b/include/modules/httpd.h
index 6431534e3..d9ab85df7 100644
--- a/include/modules/httpd.h
+++ b/include/modules/httpd.h
@@ -21,13 +21,13 @@ enum HTTPError
/* A message to someone */
struct HTTPReply
{
- HTTPError error;
+ HTTPError error = HTTP_ERROR_OK;
Anope::string content_type;
std::map<Anope::string, Anope::string, ci::less> headers;
typedef std::list<std::pair<Anope::string, Anope::string> > cookie;
std::vector<cookie> cookies;
- HTTPReply() : error(HTTP_ERROR_OK), length(0) { }
+ HTTPReply() = default;
HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
{
@@ -65,7 +65,7 @@ struct HTTPReply
};
std::deque<Data *> out;
- size_t length;
+ size_t length = 0;
void Write(const Anope::string &message)
{
diff --git a/include/modules/os_forbid.h b/include/modules/os_forbid.h
index 3ae9b7551..140731593 100644
--- a/include/modules/os_forbid.h
+++ b/include/modules/os_forbid.h
@@ -23,13 +23,13 @@ struct ForbidData
Anope::string mask;
Anope::string creator;
Anope::string reason;
- time_t created;
- time_t expires;
+ time_t created = 0;
+ time_t expires = 0;
ForbidType type;
virtual ~ForbidData() { }
protected:
- ForbidData() : created(0), expires(0) { }
+ ForbidData() = default;
};
class ForbidService : public Service
diff --git a/include/modules/os_ignore.h b/include/modules/os_ignore.h
index 69596c4bb..55eb96554 100644
--- a/include/modules/os_ignore.h
+++ b/include/modules/os_ignore.h
@@ -14,11 +14,11 @@ struct IgnoreData
Anope::string mask;
Anope::string creator;
Anope::string reason;
- time_t time; /* When do we stop ignoring them? */
+ time_t time = 0; /* When do we stop ignoring them? */
virtual ~IgnoreData() { }
protected:
- IgnoreData() : time(0) { }
+ IgnoreData() = default;
};
class IgnoreService : public Service
diff --git a/include/modules/os_session.h b/include/modules/os_session.h
index 0dd2cdcb4..8318a40ec 100644
--- a/include/modules/os_session.h
+++ b/include/modules/os_session.h
@@ -12,10 +12,10 @@
struct Session
{
cidr addr; /* A cidr (sockaddrs + len) representing this session */
- unsigned count; /* Number of clients with this host */
- unsigned hits; /* Number of subsequent kills for a host */
+ unsigned count = 1; /* Number of clients with this host */
+ unsigned hits = 0; /* Number of subsequent kills for a host */
- Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
+ Session(const sockaddrs &ip, int len) : addr(ip, len) { }
};
struct Exception : Serializable
diff --git a/include/modules/sql.h b/include/modules/sql.h
index 0be5e93d0..d78f64391 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -141,10 +141,10 @@ namespace SQL
Query query;
Anope::string error;
public:
- unsigned int id;
+ unsigned int id = 0;
Anope::string finished_query;
- Result() : id(0) { }
+ Result() = default;
Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { }
inline operator bool() const { return this->error.empty(); }