diff options
author | Sadie Powell <sadie@witchery.services> | 2022-01-03 18:34:16 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2022-01-04 00:17:13 +0000 |
commit | 7531e90499d4cd60b6464c692725225e85c00738 (patch) | |
tree | 930fd946ea495b74c4071a67e12cadb700ab79ab | |
parent | dfcc025a19d7d49179d75f34553c36e0d47eaded (diff) |
Use C++11 style class/struct initialisation.
64 files changed, 188 insertions, 230 deletions
diff --git a/include/account.h b/include/account.h index 163d7d0c6..92b892f65 100644 --- a/include/account.h +++ b/include/account.h @@ -240,8 +240,8 @@ class CoreExport IdentifyRequest Anope::string password; std::set<Module *> holds; - bool dispatched; - bool success; + bool dispatched = false; + bool success = false; static std::set<IdentifyRequest *> Requests; diff --git a/include/anope.h b/include/anope.h index d998ce1a9..96967bfb8 100644 --- a/include/anope.h +++ b/include/anope.h @@ -559,7 +559,7 @@ class CoreExport sepstream char sep; /** Current string position */ - size_t pos; + size_t pos = 0; /** If set then GetToken() can return an empty string */ bool allow_empty; diff --git a/include/base.h b/include/base.h index 09ec83edf..408f8dd16 100644 --- a/include/base.h +++ b/include/base.h @@ -16,9 +16,8 @@ class CoreExport Base { /* References to this base class */ - std::set<ReferenceBase *> *references; + std::set<ReferenceBase *> *references = nullptr; public: - Base(); virtual ~Base(); /** Adds a reference to this object. Eg, when a Reference @@ -33,9 +32,9 @@ class CoreExport Base class ReferenceBase { protected: - bool invalid; + bool invalid = false; public: - ReferenceBase() : invalid(false) { } + ReferenceBase() = default; ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { } virtual ~ReferenceBase() { } inline void Invalidate() { this->invalid = true; } @@ -48,11 +47,9 @@ template<typename T> class Reference : public ReferenceBase { protected: - T *ref; + T *ref = nullptr; public: - Reference() : ref(NULL) - { - } + Reference() = default; Reference(T *obj) : ref(obj) { diff --git a/include/commands.h b/include/commands.h index 64335720f..29fa3a601 100644 --- a/include/commands.h +++ b/include/commands.h @@ -26,8 +26,6 @@ struct CommandInfo { typedef Anope::map<CommandInfo> map; - CommandInfo() : hide(false), prepend_channel(false) { } - /* Service name of the command */ Anope::string name; /* Permission required to execute the command */ @@ -35,9 +33,9 @@ struct CommandInfo /* Group this command is in */ Anope::string group; /* whether or not to hide this command in help output */ - bool hide; + bool hide = false; /* Only used with fantasy */ - bool prepend_channel; + bool prepend_channel = false; }; /* Where the replies from commands go to. User inherits from this and is the normal diff --git a/include/config.h b/include/config.h index 82c1ad5c8..b59b5ad69 100644 --- a/include/config.h +++ b/include/config.h @@ -73,7 +73,7 @@ namespace Configuration { Anope::string name; bool executable; - FILE *fp; + FILE *fp = nullptr; public: File(const Anope::string &, bool); ~File(); diff --git a/include/lists.h b/include/lists.h index 7a3f744c6..baff1a20b 100644 --- a/include/lists.h +++ b/include/lists.h @@ -25,7 +25,7 @@ class CoreExport NumberList { private: - bool is_valid; + bool is_valid = true; std::set<unsigned> numbers; @@ -83,7 +83,7 @@ class CoreExport InfoFormatter { NickCore *nc; std::vector<std::pair<Anope::string, Anope::string> > replies; - unsigned longest; + unsigned longest = 0; public: InfoFormatter(NickCore *nc); void Process(std::vector<Anope::string> &); diff --git a/include/logger.h b/include/logger.h index 51868d917..98e1bc156 100644 --- a/include/logger.h +++ b/include/logger.h @@ -53,23 +53,23 @@ class CoreExport Log { public: /* Bot that should log this message */ - BotInfo *bi; + BotInfo *bi = nullptr; /* For commands, the user executing the command, but might not always exist */ - User *u; + User *u = nullptr; /* For commands, the account executing the command, but will not always exist */ - NickCore *nc; + NickCore *nc = nullptr; /* For commands, the command being executed */ - Command *c; + Command *c = nullptr; /* For commands, the command source */ - CommandSource *source; + CommandSource *source = nullptr; /* Used for LOG_CHANNEL */ - Channel *chan; + Channel *chan = nullptr; /* For commands, the channel the command was executed on, will not always exist */ - const ChannelInfo *ci; + const ChannelInfo *ci = nullptr; /* For LOG_SERVER */ - Server *s; + Server *s = nullptr; /* For LOG_MODULE */ - Module *m; + Module *m = nullptr; LogType type; Anope::string category; @@ -113,10 +113,10 @@ class CoreExport Log class CoreExport LogInfo { public: - BotInfo *bot; + BotInfo *bot = nullptr; std::vector<Anope::string> targets; std::vector<LogFile *> logfiles; - int last_day; + int last_day = 0; std::vector<Anope::string> sources; int log_age; std::vector<Anope::string> admin; diff --git a/include/mail.h b/include/mail.h index 932d1a6e6..65873feba 100644 --- a/include/mail.h +++ b/include/mail.h @@ -34,7 +34,7 @@ namespace Mail Anope::string message; bool dont_quote_addresses; - bool success; + bool success = false; public: /** Construct this message. Once constructed call Thread::Start to launch the mail sending. * @param sf Config->SendFrom diff --git a/include/memo.h b/include/memo.h index 112fd3c21..a41730b53 100644 --- a/include/memo.h +++ b/include/memo.h @@ -39,7 +39,7 @@ class CoreExport Memo : public Serializable */ struct CoreExport MemoInfo { - int16_t memomax; + int16_t memomax = 0; Serialize::Checker<std::vector<Memo *> > memos; std::vector<Anope::string> ignores; diff --git a/include/modes.h b/include/modes.h index cbde11429..3b4b0c1bb 100644 --- a/include/modes.h +++ b/include/modes.h @@ -394,8 +394,8 @@ class CoreExport Entry Anope::string name; Anope::string mask; public: - unsigned short cidr_len; - int family; + unsigned short cidr_len = 0; + int family = 0; Anope::string nick, user, host, real; /** Constructor 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(); } diff --git a/include/opertype.h b/include/opertype.h index 58f6049ab..9e46dda5b 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -22,7 +22,7 @@ struct CoreExport Oper /* The type of operator this operator is */ OperType *ot; /* Whether the user must be an IRC operator (umode +o) to be considered a services operator */ - bool require_oper; + bool require_oper = true; Anope::string password; Anope::string certfp; /* Hosts allowed to use this operator block */ diff --git a/include/protocol.h b/include/protocol.h index cc3329bf1..6bb649f74 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -246,8 +246,8 @@ class CoreExport IRCDProto : public Service class CoreExport MessageSource { Anope::string source; - User *u; - Server *s; + User *u = nullptr; + Server *s = nullptr; public: MessageSource(const Anope::string &); @@ -289,7 +289,7 @@ private: Anope::string message; /** The current position within the message. */ - Anope::string::size_type position; + Anope::string::size_type position = 0; public: /** Create a tokenstream and fill it with the provided data. */ diff --git a/include/serialize.h b/include/serialize.h index 406b9698f..a09f30e08 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -65,9 +65,9 @@ class CoreExport Serializable : public virtual Base /* Iterator into serializable_items */ std::list<Serializable *>::iterator s_iter; /* The hash of the last serialized form of this object committed to the database */ - size_t last_commit; + size_t last_commit = 0; /* The last time this object was committed to the database */ - time_t last_commit_time; + time_t last_commit_time = 0; protected: Serializable(const Anope::string &serialize_type); @@ -79,10 +79,10 @@ class CoreExport Serializable : public virtual Base virtual ~Serializable(); /* Unique ID (per type, not globally) for this object */ - uint64_t id; + uint64_t id = 0; /* Only used by redis, to ignore updates */ - unsigned short redis_ignore; + unsigned short redis_ignore = 0; /** Marks the object as potentially being updated "soon". */ @@ -127,7 +127,7 @@ class CoreExport Serialize::Type : public Base * this timestamp. if curtime == timestamp then we have the most up to date * version of every object of this type. */ - time_t timestamp; + time_t timestamp = 0; public: /* Map of Serializable::id to Serializable objects */ @@ -187,7 +187,7 @@ class Serialize::Checker { Anope::string name; T obj; - mutable ::Reference<Serialize::Type> type; + mutable ::Reference<Serialize::Type> type = nullptr; inline void Check() const { @@ -198,7 +198,7 @@ class Serialize::Checker } public: - Checker(const Anope::string &n) : name(n), type(NULL) { } + Checker(const Anope::string &n) : name(n) { } inline const T* operator->() const { @@ -244,12 +244,10 @@ template<typename T> class Serialize::Reference : public ReferenceBase { protected: - T *ref; + T *ref = nullptr; public: - Reference() : ref(NULL) - { - } + Reference() = default; Reference(T *obj) : ref(obj) { diff --git a/include/servers.h b/include/servers.h index f88f66187..5864b7e11 100644 --- a/include/servers.h +++ b/include/servers.h @@ -80,7 +80,7 @@ class CoreExport Server : public Extensible public: /* Number of users on the server */ - unsigned users; + unsigned users = 0; /** Delete this server with a reason * @param reason The reason diff --git a/include/threadengine.h b/include/threadengine.h index 14af252e6..e45987e26 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -19,16 +19,12 @@ class CoreExport Thread : public Pipe, public Extensible { private: /* Set to true to tell the thread to finish and we are waiting for it */ - bool exit; + bool exit = false; public: /* Handle for this thread */ pthread_t handle; - /** Threads constructor - */ - Thread(); - /** Threads destructor */ virtual ~Thread(); diff --git a/include/xline.h b/include/xline.h index 1b032ded9..f00937ba0 100644 --- a/include/xline.h +++ b/include/xline.h @@ -23,8 +23,8 @@ class CoreExport XLine : public Serializable Anope::string mask; Regex *regex; Anope::string by; - time_t created; - time_t expires; + time_t created = 0; + time_t expires = 0; Anope::string reason; XLineManager *manager; Anope::string id; diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index af2085746..3e397786e 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -150,10 +150,10 @@ class BadwordsDelCallback : public NumberList ChannelInfo *ci; BadWords *bw; Command *c; - unsigned deleted; - bool override; + unsigned deleted = 0; + bool override = false; public: - BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), override(false) + BadwordsDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c) { if (!source.AccessFor(ci).HasPriv("BADWORDS") && source.HasPriv("botserv/administration")) this->override = true; diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index f6129cdb3..ee6d324c7 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -23,9 +23,9 @@ static inline void reset_levels(ChannelInfo *ci) class AccessChanAccess : public ChanAccess { public: - int level; + int level = 0; - AccessChanAccess(AccessProvider *p) : ChanAccess(p), level(0) + AccessChanAccess(AccessProvider *p) : ChanAccess(p) { } @@ -250,12 +250,12 @@ class CommandCSAccess : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; Anope::string Nicks; - bool denied; - bool override; + bool denied = false; + bool override = false; public: - AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false) + AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c) { if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify")) this->override = true; diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index 99137430d..94e1955ff 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -211,10 +211,10 @@ class CommandCSAKick : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; AccessGroup ag; public: - AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), ag(source.AccessFor(ci)) + AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), ag(source.AccessFor(ci)) { } diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 8df4f2fca..423bdd552 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -280,11 +280,11 @@ class CommandCSXOP : public Command CommandSource &source; ChannelInfo *ci; Command *c; - unsigned deleted; + unsigned deleted = 0; Anope::string nicks; bool override; public: - XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), override(_override) + XOPDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, bool _override, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), override(_override) { } diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp index a4aeb5a3c..17dc2dad0 100644 --- a/modules/commands/hs_group.cpp +++ b/modules/commands/hs_group.cpp @@ -13,7 +13,7 @@ class CommandHSGroup : public Command { - bool setting; + bool setting = false; public: void Sync(const NickAlias *na) @@ -37,7 +37,7 @@ class CommandHSGroup : public Command setting = false; } - CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0), setting(false) + CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0) { this->SetDesc(_("Syncs the vhost for all nicks in a group")); } diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index fe53fa14d..8c82cb55c 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -16,10 +16,10 @@ static ServiceReference<XLineManager> akills("XLineManager", "xlinemanager/sglin class AkillDelCallback : public NumberList { CommandSource &source; - unsigned deleted; + unsigned deleted = 0; Command *cmd; public: - AkillDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), deleted(0), cmd(c) + AkillDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), cmd(c) { } diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index 8a18911c6..1a3189d6b 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -89,17 +89,17 @@ class DNSServer : public Serializable { Anope::string server_name; std::vector<Anope::string> ips; - unsigned limit; + unsigned limit = 0; /* wants to be in the pool */ - bool pooled; + bool pooled = false; /* is actually in the pool */ - bool active; + bool active = false; public: std::set<Anope::string, ci::less> zones; - time_t repool; + time_t repool = 0; - DNSServer(const Anope::string &sn) : Serializable("DNSServer"), server_name(sn), limit(0), pooled(false), active(false), repool(0) + DNSServer(const Anope::string &sn) : Serializable("DNSServer"), server_name(sn) { dns_servers->push_back(this); } @@ -729,15 +729,12 @@ class ModuleDNS : public Module bool remove_split_servers; bool readd_connected_servers; - time_t last_warn; + time_t last_warn = 0; public: ModuleDNS(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), - zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this), - last_warn(0) + zone_type("DNSZone", DNSZone::Unserialize), dns_type("DNSServer", DNSServer::Unserialize), commandosdns(this) { - - for (unsigned j = 0; j < dns_servers->size(); ++j) { DNSServer *s = dns_servers->at(j); diff --git a/modules/commands/os_info.cpp b/modules/commands/os_info.cpp index 1a05b71d9..652d51593 100644 --- a/modules/commands/os_info.cpp +++ b/modules/commands/os_info.cpp @@ -13,9 +13,9 @@ struct OperInfo : Serializable Anope::string target; Anope::string info; Anope::string adder; - time_t created; + time_t created = 0; - OperInfo() : Serializable("OperInfo"), created(0) { } + OperInfo() : Serializable("OperInfo") { } OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c) : Serializable("OperInfo"), target(t), info(i), adder(a), created(c) { } diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 4d63b264d..a667cac10 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -132,10 +132,10 @@ class ExceptionDelCallback : public NumberList { protected: CommandSource &source; - unsigned deleted; + unsigned deleted = 0; Command *cmd; public: - ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), deleted(0), cmd(c) + ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), cmd(c) { } diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 2f343b8d4..eedf1d02c 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -16,9 +16,9 @@ class SXLineDelCallback : public NumberList XLineManager *xlm; Command *command; CommandSource &source; - unsigned deleted; + unsigned deleted = 0; public: - SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source), deleted(0) + SXLineDelCallback(XLineManager *x, Command *c, CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), xlm(x), command(c), source(_source) { } diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 224adffac..21cb7cc22 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -19,9 +19,7 @@ class SaveData : public Serialize::Data { public: Anope::string last; - std::fstream *fs; - - SaveData() : fs(NULL) { } + std::fstream *fs = nullptr; std::iostream& operator[](const Anope::string &key) override { @@ -38,13 +36,11 @@ class SaveData : public Serialize::Data class LoadData : public Serialize::Data { public: - std::fstream *fs; - unsigned int id; + std::fstream *fs = nullptr; + unsigned int id = 0; std::map<Anope::string, Anope::string> data; std::stringstream ss; - bool read; - - LoadData() : fs(NULL), id(0), read(false) { } + bool read = false; std::iostream& operator[](const Anope::string &key) override { @@ -106,12 +102,12 @@ class LoadData : public Serialize::Data class DBFlatFile : public Module, public Pipe { /* Day the last backup was on */ - int last_day; + int last_day = 0; /* Backup file names */ std::map<Anope::string, std::list<Anope::string> > backups; - bool loaded; + bool loaded = false; - int child_pid; + int child_pid = -1; void BackupDatabase() { @@ -172,7 +168,7 @@ class DBFlatFile : public Module, public Pipe } public: - DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), last_day(0), loaded(false), child_pid(-1) + DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR) { } diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index 0fa601cfa..0c32310f3 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -63,10 +63,10 @@ class DBSQL : public Module, public Pipe bool import; std::set<Serializable *> updated_items; - bool shutting_down; - bool loading_databases; - bool loaded; - bool imported; + bool shutting_down = false; + bool loading_databases = false; + bool loaded = false; + bool imported = false; void RunBackground(const Query &q, Interface *iface = NULL) { @@ -90,7 +90,7 @@ class DBSQL : public Module, public Pipe } public: - DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this), shutting_down(false), loading_databases(false), loaded(false), imported(false) + DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this) { diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp index e9182d7d9..b72c9af56 100644 --- a/modules/extra/m_ldap.cpp +++ b/modules/extra/m_ldap.cpp @@ -29,18 +29,15 @@ class LDAPRequest public: LDAPService *service; LDAPInterface *inter; - LDAPMessage *message; /* message returned by ldap_ */ - LDAPResult *result; /* final result */ + LDAPMessage *message = nullptr; /* message returned by ldap_ */ + LDAPResult *result = nullptr; /* final result */ struct timeval tv; - QueryType type; + QueryType type = QUERY_UNKNOWN; LDAPRequest(LDAPService *s, LDAPInterface *i) : service(s) , inter(i) - , message(NULL) - , result(NULL) { - type = QUERY_UNKNOWN; tv.tv_sec = 0; tv.tv_usec = 100000; } @@ -147,7 +144,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition LDAP *con; - time_t last_connect; + time_t last_connect = 0; public: static LDAPMod **BuildMods(const LDAPMods &attributes) @@ -232,7 +229,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition query_queue queries, results; Mutex process_mutex; /* held when processing requests not in either queue */ - LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p), last_connect(0) + LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p) { Connect(); } diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp index cac2035a0..ab67bd919 100644 --- a/modules/extra/m_ldap_authentication.cpp +++ b/modules/extra/m_ldap_authentication.cpp @@ -22,10 +22,10 @@ struct IdentifyInfo Reference<User> user; IdentifyRequest *req; ServiceReference<LDAPProvider> lprov; - bool admin_bind; + bool admin_bind = true; Anope::string dn; - IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true) + IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp) { req->Hold(me); } diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index fb9e4888f..3b4b0ea3f 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -61,7 +61,7 @@ struct QueryResult */ class MySQLResult : public Result { - MYSQL_RES *res; + MYSQL_RES *res = nullptr; public: MySQLResult(unsigned int i, const Query &q, const Anope::string &fq, MYSQL_RES *r) : Result(i, q, fq), res(r) @@ -94,7 +94,7 @@ class MySQLResult : public Result } } - MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err), res(NULL) + MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err) { } @@ -117,7 +117,7 @@ class MySQLService : public Provider Anope::string password; int port; - MYSQL *sql; + MYSQL *sql = nullptr; /** Escape a query. * Note the mutex must be held! @@ -300,7 +300,7 @@ class ModuleSQL : public Module, public Pipe }; MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, int po) -: Provider(o, n), database(d), server(s), user(u), password(p), port(po), sql(NULL) +: Provider(o, n), database(d), server(s), user(u), password(p), port(po) { Connect(); } diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 39dad2f02..1a2bed1f1 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -44,7 +44,7 @@ class SQLiteService : public Provider Anope::string database; - sqlite3 *sql; + sqlite3 *sql = nullptr; Anope::string Escape(const Anope::string &query); @@ -134,7 +134,7 @@ class ModuleSQLite : public Module }; SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::string &d) -: Provider(o, n), database(d), sql(NULL) +: Provider(o, n), database(d) { int db = sqlite3_open_v2(database.c_str(), &this->sql, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (db != SQLITE_OK) diff --git a/modules/extra/m_ssl_gnutls.cpp b/modules/extra/m_ssl_gnutls.cpp index 18c561266..c6b532269 100644 --- a/modules/extra/m_ssl_gnutls.cpp +++ b/modules/extra/m_ssl_gnutls.cpp @@ -36,7 +36,7 @@ class MySSLService : public SSLService class SSLSocketIO : public SocketIO { public: - gnutls_session_t sess; + gnutls_session_t sess = nullptr; GnuTLS::X509CertCredentials* mycreds; /** Constructor @@ -115,11 +115,9 @@ namespace GnuTLS class DHParams { - gnutls_dh_params_t dh_params; + gnutls_dh_params_t dh_params = nullptr; public: - DHParams() : dh_params(NULL) { } - void Import(const Anope::string &dhstr) { if (dh_params != NULL) @@ -225,7 +223,7 @@ namespace GnuTLS class X509CertCredentials { - unsigned int refcount; + unsigned int refcount = 0; gnutls_certificate_credentials_t cred; DHParams dh; @@ -247,7 +245,7 @@ namespace GnuTLS X509Key key; X509CertCredentials(const Anope::string &certfile, const Anope::string &keyfile) - : refcount(0), certs(LoadFile(certfile)), key(LoadFile(keyfile)) + : certs(LoadFile(certfile)), key(LoadFile(keyfile)) { if (gnutls_certificate_allocate_credentials(&cred) < 0) throw ConfigException("Cannot allocate certificate credentials"); @@ -299,10 +297,10 @@ class GnuTLSModule : public Module GnuTLS::Init libinit; public: - GnuTLS::X509CertCredentials *cred; + GnuTLS::X509CertCredentials *cred = nullptr; MySSLService service; - GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), cred(NULL), service(this, "ssl") + GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), service(this, "ssl") { me = this; this->SetPermanent(true); @@ -630,7 +628,7 @@ void SSLSocketIO::Destroy() delete this; } -SSLSocketIO::SSLSocketIO() : sess(NULL), mycreds(me->cred) +SSLSocketIO::SSLSocketIO() : mycreds(me->cred) { mycreds->incrref(); } diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 1169f6cbe..50c4c60a0 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -209,11 +209,11 @@ class Packet : public Query /* Source or destination of the packet */ sockaddrs addr; /* ID for this packet */ - unsigned short id; + unsigned short id = 0; /* Flags on the packet */ - unsigned short flags; + unsigned short flags = 0; - Packet(Manager *m, sockaddrs *a) : manager(m), id(0), flags(0) + Packet(Manager *m, sockaddrs *a) : manager(m) { if (a) addr = *a; @@ -468,13 +468,13 @@ class TCPSocket : public ListenSocket class Client : public ClientSocket, public Timer, public ReplySocket { Manager *manager; - Packet *packet; + Packet *packet = nullptr; unsigned char packet_buffer[524]; - int length; + int length = 0; public: Client(Manager *m, TCPSocket *l, int fd, const sockaddrs &addr) : Socket(fd, l->IsIPv6()), ClientSocket(l, addr), Timer(5), - manager(m), packet(NULL), length(0) + manager(m) { Log(LOG_DEBUG_2) << "Resolver: New client from " << addr.addr(); } @@ -652,18 +652,17 @@ class MyManager : public Manager, public Timer typedef TR1NS::unordered_map<Question, Query, Question::hash> cache_map; cache_map cache; - TCPSocket *tcpsock; - UDPSocket *udpsock; + TCPSocket *tcpsock = nullptr; + UDPSocket *udpsock = nullptr; - bool listen; + bool listen = false; sockaddrs addrs; std::vector<std::pair<Anope::string, short> > notify; public: std::map<unsigned short, Request *> requests; - MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), tcpsock(NULL), udpsock(NULL), - listen(false), cur_id(rand()) + MyManager(Module *creator) : Manager(creator), Timer(300, Anope::CurTime, true), serial(Anope::CurTime), cur_id(rand()) { } diff --git a/modules/m_dnsbl.cpp b/modules/m_dnsbl.cpp index 3e867ff1d..79fa92a73 100644 --- a/modules/m_dnsbl.cpp +++ b/modules/m_dnsbl.cpp @@ -18,20 +18,18 @@ struct Blacklist { struct Reply { - int code; + int code = 0; Anope::string reason; - bool allow_account; + bool allow_account = false; - Reply() : code(0), allow_account(false) { } + Reply() = default; }; Anope::string name; - time_t bantime; + time_t bantime = 0; Anope::string reason; std::vector<Reply> replies; - Blacklist() : bantime(0) { } - Reply *Find(int code) { for (unsigned int i = 0; i < replies.size(); ++i) diff --git a/modules/m_httpd.cpp b/modules/m_httpd.cpp index 715e42c3d..ad2a28b99 100644 --- a/modules/m_httpd.cpp +++ b/modules/m_httpd.cpp @@ -41,19 +41,19 @@ class MyHTTPClient : public HTTPClient { HTTPProvider *provider; HTTPMessage message; - bool header_done, served; + bool header_done = false, served = false; Anope::string page_name; Reference<HTTPPage> page; Anope::string ip; - unsigned content_length; + unsigned content_length = 0; enum { ACTION_NONE, ACTION_GET, ACTION_POST - } action; + } action = ACTION_NONE; void Serve() { @@ -94,7 +94,7 @@ class MyHTTPClient : public HTTPClient public: time_t created; - MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), header_done(false), served(false), ip(a.addr()), content_length(0), action(ACTION_NONE), created(Anope::CurTime) + MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), ip(a.addr()), created(Anope::CurTime) { Log(LOG_DEBUG, "httpd") << "Accepted connection " << f << " from " << a.addr(); } diff --git a/modules/m_redis.cpp b/modules/m_redis.cpp index df3de871c..62c831a44 100644 --- a/modules/m_redis.cpp +++ b/modules/m_redis.cpp @@ -82,13 +82,12 @@ class MyRedisService : public Provider int port; unsigned db; - RedisSocket *sock, *sub; + RedisSocket *sock = nullptr, *sub = nullptr; Transaction ti; - bool in_transaction; + bool in_transaction = false; - MyRedisService(Module *c, const Anope::string &n, const Anope::string &h, int p, unsigned d) : Provider(c, n), host(h), port(p), db(d), sock(NULL), sub(NULL), - ti(c), in_transaction(false) + MyRedisService(Module *c, const Anope::string &n, const Anope::string &h, int p, unsigned d) : Provider(c, n), host(h), port(p), db(d), ti(c) { sock = new RedisSocket(this, host.find(':') != Anope::string::npos); sock->Connect(host, port); diff --git a/modules/m_sasl.cpp b/modules/m_sasl.cpp index 3918a3152..db0ec3d17 100644 --- a/modules/m_sasl.cpp +++ b/modules/m_sasl.cpp @@ -303,7 +303,7 @@ class ModuleSASL : public Module SASLService sasl; Plain plain; - External *external; + External *external = nullptr; std::vector<Anope::string> mechs; @@ -322,7 +322,7 @@ class ModuleSASL : public Module public: ModuleSASL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - sasl(this), plain(this), external(NULL) + sasl(this), plain(this) { try { diff --git a/modules/ns_maxemail.cpp b/modules/ns_maxemail.cpp index aae6f0a63..3d5dec0c7 100644 --- a/modules/ns_maxemail.cpp +++ b/modules/ns_maxemail.cpp @@ -14,7 +14,7 @@ class NSMaxEmail : public Module { - bool clean; + bool clean = false; /* strip dots from username, and remove anything after the first + */ Anope::string CleanMail(const Anope::string &email) @@ -77,7 +77,6 @@ class NSMaxEmail : public Module public: NSMaxEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) - , clean(false) { } diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index 753cb7cd4..fd8d61cb1 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -809,21 +809,19 @@ struct IRCDMessageCapab : Message::Capab struct ModeInfo { // The letter assigned to the mode (e.g. o). - char letter; + char letter = 0; // If a prefix mode then the rank of the prefix. - unsigned level; + unsigned level = 0; // The name of the mode. Anope::string name; // If a prefix mode then the symbol associated with the prefix. - char symbol; + char symbol = 0; // The type of mode. Anope::string type; - - ModeInfo() : letter(0), level(0), symbol(0) { } }; static bool ParseMode(const Anope::string& token, ModeInfo& mode) @@ -1296,9 +1294,9 @@ struct IRCDMessageKick : IRCDMessage struct IRCDMessageSave : IRCDMessage { - time_t last_collide; + time_t last_collide = 0; - IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2), last_collide(0) { } + IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2) { } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index a98c5bd40..100b0e50b 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -25,11 +25,11 @@ class ChanServCore : public Module, public ChanServService std::vector<Anope::string> defaults; ExtensibleItem<bool> inhabit; ExtensibleRef<bool> persist; - bool always_lower; + bool always_lower = false; public: ChanServCore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PSEUDOCLIENT | VENDOR), - ChanServService(this), inhabit(this, "inhabit"), persist("PERSIST"), always_lower(false) + ChanServService(this), inhabit(this, "inhabit"), persist("PERSIST") { } diff --git a/modules/webcpanel/pages/index.h b/modules/webcpanel/pages/index.h index fb7f759f9..715fc72ec 100644 --- a/modules/webcpanel/pages/index.h +++ b/modules/webcpanel/pages/index.h @@ -15,10 +15,10 @@ class Index : public WebPanelPage static const int FLUSH_TIME = 60; Anope::hash_map<time_t> last_login_attempt; - time_t last_clear; + time_t last_clear = 0; public: - Index(const Anope::string &u) : WebPanelPage(u), last_clear(0) { } + Index(const Anope::string &u) : WebPanelPage(u) { } bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) override; }; diff --git a/src/account.cpp b/src/account.cpp index b8ac2cbda..e9768161b 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -18,7 +18,7 @@ std::set<IdentifyRequest *> IdentifyRequest::Requests; -IdentifyRequest::IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), account(acc), password(pass), dispatched(false), success(false) +IdentifyRequest::IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), account(acc), password(pass) { Requests.insert(this); } diff --git a/src/base.cpp b/src/base.cpp index b1b64c633..b52157859 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -13,10 +13,6 @@ std::map<Anope::string, std::map<Anope::string, Service *> > Service::Services; std::map<Anope::string, std::map<Anope::string, Anope::string> > Service::Aliases; -Base::Base() : references(NULL) -{ -} - Base::~Base() { if (this->references != NULL) diff --git a/src/config.cpp b/src/config.cpp index db574584f..f323ae6c7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -636,7 +636,7 @@ Block *Conf::GetCommand(CommandSource &source) return &(Config->EmptyBlock); } -File::File(const Anope::string &n, bool e) : name(n), executable(e), fp(NULL) +File::File(const Anope::string &n, bool e) : name(n), executable(e) { } diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 9fcf766f3..9497078d7 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -91,7 +91,7 @@ bool ci::less::operator()(const Anope::string &s1, const Anope::string &s2) cons return s1.ci_str().compare(s2.ci_str()) < 0; } -sepstream::sepstream(const Anope::string &source, char separator, bool ae) : tokens(source), sep(separator), pos(0), allow_empty(ae) +sepstream::sepstream(const Anope::string &source, char separator, bool ae) : tokens(source), sep(separator), allow_empty(ae) { } diff --git a/src/logger.cpp b/src/logger.cpp index b446e404f..c39219440 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -74,11 +74,11 @@ const Anope::string &LogFile::GetName() const return this->filename; } -Log::Log(LogType t, const Anope::string &cat, BotInfo *b) : bi(b), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(t), category(cat) +Log::Log(LogType t, const Anope::string &cat, BotInfo *b) : bi(b), type(t), category(cat) { } -Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.GetUser()), nc(src.nc), c(_c), source(&src), chan(NULL), ci(_ci), s(NULL), m(NULL), type(t) +Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.GetUser()), nc(src.nc), c(_c), source(&src), ci(_ci), type(t) { if (!c) throw CoreException("Invalid pointers passed to Log::Log"); @@ -87,35 +87,34 @@ Log::Log(LogType t, CommandSource &src, Command *_c, ChannelInfo *_ci) : u(src.G throw CoreException("This constructor does not support this log type"); size_t sl = c->name.find('/'); - this->bi = NULL; if (sl != Anope::string::npos) this->bi = BotInfo::Find(c->name.substr(0, sl), true); this->category = c->name; } -Log::Log(User *_u, Channel *ch, const Anope::string &cat) : bi(NULL), u(_u), nc(NULL), c(NULL), source(NULL), chan(ch), ci(chan ? *chan->ci : NULL), s(NULL), m(NULL), type(LOG_CHANNEL), category(cat) +Log::Log(User *_u, Channel *ch, const Anope::string &cat) : u(_u), chan(ch), ci(chan ? *chan->ci : nullptr), type(LOG_CHANNEL), category(cat) { if (!chan) throw CoreException("Invalid pointers passed to Log::Log"); } -Log::Log(User *_u, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(_u), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(LOG_USER), category(cat) +Log::Log(User *_u, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(_u), type(LOG_USER), category(cat) { if (!u) throw CoreException("Invalid pointers passed to Log::Log"); } -Log::Log(Server *serv, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(serv), m(NULL), type(LOG_SERVER), category(cat) +Log::Log(Server *serv, const Anope::string &cat, BotInfo *_bi) : bi(_bi), s(serv), type(LOG_SERVER), category(cat) { if (!s) throw CoreException("Invalid pointer passed to Log::Log"); } -Log::Log(BotInfo *b, const Anope::string &cat) : bi(b), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(NULL), type(LOG_NORMAL), category(cat) +Log::Log(BotInfo *b, const Anope::string &cat) : bi(b), type(LOG_NORMAL), category(cat) { } -Log::Log(Module *mod, const Anope::string &cat, BotInfo *_bi) : bi(_bi), u(NULL), nc(NULL), c(NULL), source(NULL), chan(NULL), ci(NULL), s(NULL), m(mod), type(LOG_MODULE), category(cat) +Log::Log(Module *mod, const Anope::string &cat, BotInfo *_bi) : bi(_bi), m(mod), type(LOG_MODULE), category(cat) { } @@ -227,7 +226,7 @@ Anope::string Log::BuildPrefix() const return buffer; } -LogInfo::LogInfo(int la, bool rio, bool ldebug) : bot(NULL), last_day(0), log_age(la), raw_io(rio), debug(ldebug) +LogInfo::LogInfo(int la, bool rio, bool ldebug) : log_age(la), raw_io(rio), debug(ldebug) { } diff --git a/src/mail.cpp b/src/mail.cpp index a1db0b232..2f765dac4 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -13,7 +13,7 @@ #include "mail.h" #include "config.h" -Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread(), sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")), send_from(sf), mail_to(mailto), addr(a), subject(s), message(m), dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")), success(false) +Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread(), sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")), send_from(sf), mail_to(mailto), addr(a), subject(s), message(m), dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")) { } diff --git a/src/memos.cpp b/src/memos.cpp index 1e0570bd3..4c6ee8deb 100644 --- a/src/memos.cpp +++ b/src/memos.cpp @@ -76,7 +76,7 @@ Serializable* Memo::Unserialize(Serializable *obj, Serialize::Data &data) return m; } -MemoInfo::MemoInfo() : memomax(0), memos("Memo") +MemoInfo::MemoInfo() : memos("Memo") { } diff --git a/src/misc.cpp b/src/misc.cpp index aa49b10bf..815b8dc39 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -27,7 +27,7 @@ #include <netdb.h> #endif -NumberList::NumberList(const Anope::string &list, bool descending) : is_valid(true), desc(descending) +NumberList::NumberList(const Anope::string &list, bool descending) : desc(descending) { Anope::string error; commasepstream sep(list); @@ -214,7 +214,7 @@ void ListFormatter::Process(std::vector<Anope::string> &buffer) } } -InfoFormatter::InfoFormatter(NickCore *acc) : nc(acc), longest(0) +InfoFormatter::InfoFormatter(NickCore *acc) : nc(acc) { } diff --git a/src/modes.cpp b/src/modes.cpp index d6e3ff92f..e6568d98f 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -46,9 +46,7 @@ struct StackerInfo /* Modes to be deleted */ std::list<std::pair<Mode *, Anope::string> > DelModes; /* Bot this is sent from */ - BotInfo *bi; - - StackerInfo() : bi(NULL) { } + BotInfo *bi = nullptr; /** Add a mode to this object * @param mode The mode @@ -742,7 +740,7 @@ void ModeManager::StackerDel(Mode *m) } } -Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh), cidr_len(0), family(0) +Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh) { Anope::string n, u, h; diff --git a/src/opertype.cpp b/src/opertype.cpp index ee1e26096..006e780b7 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -13,7 +13,7 @@ std::vector<Oper *> Oper::opers; -Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o), require_oper(true) +Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o) { opers.push_back(this); } diff --git a/src/process.cpp b/src/process.cpp index dc6bd7994..ddb0a8750 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -133,7 +133,6 @@ Anope::string IRCDProto::Format(const Anope::string &source, const Anope::string MessageTokenizer::MessageTokenizer(const Anope::string &msg) : message(msg) - , position(0) { } diff --git a/src/protocol.cpp b/src/protocol.cpp index 375104812..7027b64d0 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -450,7 +450,7 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask) return Entry("", mask).GetNUHMask(); } -MessageSource::MessageSource(const Anope::string &src) : source(src), u(NULL), s(NULL) +MessageSource::MessageSource(const Anope::string &src) : source(src) { /* no source for incoming message is our uplink */ if (src.empty()) @@ -461,11 +461,11 @@ MessageSource::MessageSource(const Anope::string &src) : source(src), u(NULL), s this->u = User::Find(src); } -MessageSource::MessageSource(User *_u) : source(_u ? _u->nick : ""), u(_u), s(NULL) +MessageSource::MessageSource(User *_u) : source(_u ? _u->nick : ""), u(_u) { } -MessageSource::MessageSource(Server *_s) : source(_s ? _s->GetName() : ""), u(NULL), s(_s) +MessageSource::MessageSource(Server *_s) : source(_s ? _s->GetName() : ""), s(_s) { } diff --git a/src/serialize.cpp b/src/serialize.cpp index 86cc7e7b5..4c3e6f0f8 100644 --- a/src/serialize.cpp +++ b/src/serialize.cpp @@ -41,7 +41,7 @@ void Serialize::CheckTypes() } } -Serializable::Serializable(const Anope::string &serialize_type) : last_commit(0), last_commit_time(0), id(0), redis_ignore(0) +Serializable::Serializable(const Anope::string &serialize_type) { if (SerializableItems == NULL) SerializableItems = new std::list<Serializable *>(); @@ -55,7 +55,7 @@ Serializable::Serializable(const Anope::string &serialize_type) : last_commit(0) FOREACH_MOD(OnSerializableConstruct, (this)); } -Serializable::Serializable(const Serializable &other) : last_commit(0), last_commit_time(0), id(0), redis_ignore(0) +Serializable::Serializable(const Serializable &other) { SerializableItems->push_back(this); this->s_iter = SerializableItems->end(); @@ -112,7 +112,7 @@ const std::list<Serializable *> &Serializable::GetItems() return *SerializableItems; } -Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), unserialize(f), owner(o), timestamp(0) +Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), unserialize(f), owner(o) { TypeOrder.push_back(this->name); Types[this->name] = this; diff --git a/src/servers.cpp b/src/servers.cpp index 8ee5ed70b..5892b4f24 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -27,7 +27,7 @@ Anope::map<Server *> Servers::ByID; std::set<Anope::string> Servers::Capab; -Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Anope::string &desc, const Anope::string &ssid, bool jupe) : name(sname), hops(shops), description(desc), sid(ssid), uplink(up), users(0) +Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Anope::string &desc, const Anope::string &ssid, bool jupe) : name(sname), hops(shops), description(desc), sid(ssid), uplink(up) { syncing = true; juped = jupe; diff --git a/src/threadengine.cpp b/src/threadengine.cpp index e9ff8148d..4dd439a51 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -44,10 +44,6 @@ static void *entry_point(void *parameter) return NULL; } -Thread::Thread() : exit(false) -{ -} - Thread::~Thread() { } diff --git a/src/xline.cpp b/src/xline.cpp index b1ca796ce..50c84e8e2 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -86,7 +86,7 @@ void XLine::Init() } } -XLine::XLine(const Anope::string &ma, const Anope::string &r, const Anope::string &uid) : Serializable("XLine"), mask(ma), by(Me->GetName()), created(0), expires(0), reason(r), id(uid) +XLine::XLine(const Anope::string &ma, const Anope::string &r, const Anope::string &uid) : Serializable("XLine"), mask(ma), by(Me->GetName()), reason(r), id(uid) { regex = NULL; manager = NULL; |