aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-02-06 11:25:42 +0000
committerGravatar Sadie Powell2020-02-06 11:25:42 +0000
commit98e4ddfb21d285c8b675788c155bb204822fbd4a (patch)
tree030eb18c989bf3c9e4768a538796e3221ca7934e /include
parentIn C++11 [io]fstream has std::string constructors; use them. (diff)
Use C++11 inline initialisation for class members.
Diffstat (limited to 'include')
-rw-r--r--include/base.h10
-rw-r--r--include/channels.h2
-rw-r--r--include/clientprotocol.h22
-rw-r--r--include/commands/cmd_whowas.h10
-rw-r--r--include/configreader.h4
-rw-r--r--include/ctables.h12
-rw-r--r--include/dynamic.h4
-rw-r--r--include/dynref.h4
-rw-r--r--include/fileutils.h4
-rw-r--r--include/hashcomp.h4
-rw-r--r--include/inspircd.h50
-rw-r--r--include/inspsocket.h15
-rw-r--r--include/intrusive_list.h10
-rw-r--r--include/intrusive_list_impl.h15
-rw-r--r--include/iohook.h3
-rw-r--r--include/logger.h5
-rw-r--r--include/message.h12
-rw-r--r--include/mode.h10
-rw-r--r--include/modules.h14
-rw-r--r--include/modules/cap.h3
-rw-r--r--include/modules/ctctags.h8
-rw-r--r--include/modules/dns.h30
-rw-r--r--include/modules/invite.h2
-rw-r--r--include/modules/ircv3_batch.h13
-rw-r--r--include/modules/ssl.h7
-rw-r--r--include/modules/who.h10
-rw-r--r--include/numeric.h3
-rw-r--r--include/numericbuilder.h3
-rw-r--r--include/server.h6
-rw-r--r--include/snomasks.h6
-rw-r--r--include/socketengine.h19
-rw-r--r--include/usermanager.h5
-rw-r--r--include/users.h48
-rw-r--r--include/xline.h3
34 files changed, 162 insertions, 214 deletions
diff --git a/include/base.h b/include/base.h
index deeabf255..c1278f5bc 100644
--- a/include/base.h
+++ b/include/base.h
@@ -89,7 +89,7 @@ class CoreExport interfacebase
*/
class CoreExport refcountbase
{
- mutable unsigned int refcount;
+ mutable unsigned int refcount = 0;
public:
refcountbase();
virtual ~refcountbase();
@@ -112,9 +112,9 @@ class CoreExport refcountbase
*/
class CoreExport usecountbase
{
- mutable unsigned int usecount;
+ mutable unsigned int usecount = 0;
public:
- usecountbase() : usecount(0) { }
+ usecountbase() = default;
~usecountbase();
inline unsigned int GetUseCount() const { return usecount; }
inline void refcount_inc() const { usecount++; }
@@ -128,9 +128,9 @@ class CoreExport usecountbase
template <typename T>
class reference
{
- T* value;
+ T* value = nullptr;
public:
- reference() : value(0) { }
+ reference() = default;
reference(T* v) : value(v) { if (value) value->refcount_inc(); }
reference(const reference<T>& v) : value(v.value) { if (value) value->refcount_inc(); }
reference<T>& operator=(const reference<T>& other)
diff --git a/include/channels.h b/include/channels.h
index f01a0434f..1876c4073 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -103,7 +103,7 @@ class CoreExport Channel : public Extensible
/** Time topic was set.
* If no topic was ever set, this will be equal to Channel::created
*/
- time_t topicset;
+ time_t topicset = 0;
/** The last user to set the topic.
* If this member is an empty string, no topic was ever set.
diff --git a/include/clientprotocol.h b/include/clientprotocol.h
index e0ac78a88..7320525a8 100644
--- a/include/clientprotocol.h
+++ b/include/clientprotocol.h
@@ -227,7 +227,7 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
operator const std::string&() const { return (owned ? *str : *ptr); }
Param()
- : ptr(NULL)
+ : ptr(nullptr)
, owned(false)
{
}
@@ -285,9 +285,9 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
ParamList params;
TagMap tags;
std::string command;
- bool msginit_done;
+ bool msginit_done = false;
mutable SerializedList serlist;
- bool sideeffect;
+ bool sideeffect = false;
protected:
/** Set command string.
@@ -309,8 +309,6 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
Message(const char* cmd, User* Sourceuser = NULL)
: ClientProtocol::MessageSource(Sourceuser)
, command(cmd ? cmd : std::string())
- , msginit_done(false)
- , sideeffect(false)
{
params.reserve(8);
serlist.reserve(8);
@@ -326,8 +324,6 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
Message(const char* cmd, const std::string& Sourcestr, User* Sourceuser = NULL)
: ClientProtocol::MessageSource(Sourcestr, Sourceuser)
, command(cmd ? cmd : std::string())
- , msginit_done(false)
- , sideeffect(false)
{
params.reserve(8);
serlist.reserve(8);
@@ -462,9 +458,9 @@ class ClientProtocol::Message : public ClientProtocol::MessageSource
class ClientProtocol::Event
{
EventProvider* event;
- Message* initialmsg;
- const MessageList* initialmsglist;
- bool eventinit_done;
+ Message* initialmsg = nullptr;
+ const MessageList* initialmsglist = nullptr;
+ bool eventinit_done = false;
public:
/** Constructor.
@@ -472,9 +468,6 @@ class ClientProtocol::Event
*/
Event(EventProvider& protoeventprov)
: event(&protoeventprov)
- , initialmsg(NULL)
- , initialmsglist(NULL)
- , eventinit_done(false)
{
}
@@ -484,9 +477,6 @@ class ClientProtocol::Event
*/
Event(EventProvider& protoeventprov, ClientProtocol::Message& msg)
: event(&protoeventprov)
- , initialmsg(&msg)
- , initialmsglist(NULL)
- , eventinit_done(false)
{
}
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index 5a07f60a0..ea5b00c8a 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -135,10 +135,6 @@ namespace WhoWas
*/
bool IsEnabled() const;
- /** Constructor
- */
- Manager();
-
/** Destructor
*/
~Manager();
@@ -162,16 +158,16 @@ namespace WhoWas
/** Max number of WhoWas entries per user.
*/
- unsigned int GroupSize;
+ unsigned int GroupSize = 0;
/** Max number of cumulative user-entries in WhoWas.
* When max reached and added to, push out oldest entry FIFO style.
*/
- unsigned int MaxGroups;
+ unsigned int MaxGroups = 0;
/** Max seconds a user is kept in WhoWas before being pruned.
*/
- unsigned int MaxKeep;
+ unsigned int MaxKeep = 0;
/** Shrink all data structures to honor the current settings
*/
diff --git a/include/configreader.h b/include/configreader.h
index 27c6ba899..7455cabb1 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -380,7 +380,7 @@ class CoreExport ServerConfig
bool HideBans;
/** True if raw I/O is being logged */
- bool RawLog;
+ bool RawLog = false;
/** Set to a non-empty string to obfuscate server names. */
std::string HideServer;
@@ -455,7 +455,7 @@ class CoreExport ServerConfig
/** If this value is true, snotices will not stack when repeats are sent
*/
- bool NoSnoticeStack;
+ bool NoSnoticeStack = false;
};
/** The background thread for config reading, so that reading from executable includes
diff --git a/include/ctables.h b/include/ctables.h
index 9489d9525..91eb5eb00 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -150,7 +150,7 @@ class CoreExport CommandBase : public ServiceProvider
/** User flags needed to execute the command or 0
*/
- unsigned char flags_needed;
+ unsigned char flags_needed = 0;
/** Minimum number of parameters command takes
*/
@@ -164,11 +164,11 @@ class CoreExport CommandBase : public ServiceProvider
/** used by /stats m
*/
- unsigned long use_count;
+ unsigned long use_count = 0;
/** True if the command can be issued before registering
*/
- bool works_before_reg;
+ bool works_before_reg = false;
/** True if the command allows an empty last parameter.
* When false and the last parameter is empty, it's popped BEFORE
@@ -177,7 +177,7 @@ class CoreExport CommandBase : public ServiceProvider
* param).
* True by default
*/
- bool allow_empty_last_param;
+ bool allow_empty_last_param = true;
/** Syntax string for the command, displayed if non-empty string.
* This takes place of the text in the 'not enough parameters' numeric.
@@ -191,7 +191,7 @@ class CoreExport CommandBase : public ServiceProvider
/** How many seconds worth of penalty does this command have?
*/
- unsigned int Penalty;
+ unsigned int Penalty = 1;
/** Create a new command.
* @param me The module which created this command.
@@ -227,7 +227,7 @@ class CoreExport Command : public CommandBase
/** If true, the command will not be forwarded by the linking module even if it comes via ENCAP.
* Can be used to forward commands before their effects.
*/
- bool force_manual_route;
+ bool force_manual_route = false;
Command(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0);
diff --git a/include/dynamic.h b/include/dynamic.h
index 3a312a382..ad995042a 100644
--- a/include/dynamic.h
+++ b/include/dynamic.h
@@ -36,9 +36,9 @@ class CoreExport DLLManager : public classbase
/** The module library handle. */
#ifdef _WIN32
- HMODULE lib;
+ HMODULE lib = INVALID_HANDLE_VALUE;
#else
- void* lib;
+ void* lib = nullptr;
#endif
/** The filename of the module library. */
diff --git a/include/dynref.h b/include/dynref.h
index 2569d755c..85b306a2b 100644
--- a/include/dynref.h
+++ b/include/dynref.h
@@ -35,10 +35,10 @@ class CoreExport dynamic_reference_base : public interfacebase, public insp::int
private:
std::string name;
- CaptureHook* hook;
+ CaptureHook* hook = nullptr;
void resolve();
protected:
- ServiceProvider* value;
+ ServiceProvider* value = nullptr;
public:
ModuleRef creator;
dynamic_reference_base(Module* Creator, const std::string& Name);
diff --git a/include/fileutils.h b/include/fileutils.h
index 97ddec149..09540e05a 100644
--- a/include/fileutils.h
+++ b/include/fileutils.h
@@ -27,11 +27,11 @@ class CoreExport FileReader
std::vector<std::string> lines;
/** File size in bytes. */
- unsigned long totalSize;
+ unsigned long totalSize = 0;
public:
/** Initializes a new file reader. */
- FileReader() : totalSize(0) { }
+ FileReader() = default;
/** Initializes a new file reader and reads the specified file.
* @param filename The file to read into memory.
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 12e4db7ac..431c2d946 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -125,7 +125,7 @@ namespace irc
char sep;
/** Current string position
*/
- size_t pos;
+ size_t pos = 0;
/** If set then GetToken() can return an empty string
*/
bool allow_empty;
@@ -215,7 +215,7 @@ namespace irc
std::string message;
/** The current position within the message. */
- size_t position;
+ size_t position = 0;
public:
/** Create a tokenstream and fill it with the provided data. */
diff --git a/include/inspircd.h b/include/inspircd.h
index 9aee08d79..6bd14c0e9 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -109,45 +109,57 @@ class serverstats
public:
/** Number of accepted connections
*/
- unsigned long Accept;
+ unsigned long Accept = 0;
+
/** Number of failed accepts
*/
- unsigned long Refused;
+ unsigned long Refused = 0;
+
/** Number of unknown commands seen
*/
- unsigned long Unknown;
+ unsigned long Unknown = 0;
+
/** Number of nickname collisions handled
*/
- unsigned long Collisions;
+ unsigned long Collisions = 0;
+
/** Number of DNS queries sent out
*/
- unsigned long Dns;
+ unsigned long Dns = 0;
+
/** Number of good DNS replies received
* NOTE: This may not tally to the number sent out,
* due to timeouts and other latency issues.
*/
- unsigned long DnsGood;
+ unsigned long DnsGood = 0;
+
/** Number of bad (negative) DNS replies received
* NOTE: This may not tally to the number sent out,
* due to timeouts and other latency issues.
*/
- unsigned long DnsBad;
+ unsigned long DnsBad = 0;
+
/** Number of inbound connections seen
*/
- unsigned long Connects;
+ unsigned long Connects = 0;
+
/** Total bytes of data transmitted
*/
- unsigned long Sent;
+ unsigned long Sent = 0;
+
/** Total bytes of data received
*/
- unsigned long Recv;
+ unsigned long Recv = 0;
+
#ifdef _WIN32
/** Cpu usage at last sample
*/
FILETIME LastCPU;
+
/** Time QP sample was read
*/
LARGE_INTEGER LastSampled;
+
/** QP frequency
*/
LARGE_INTEGER QPFrequency;
@@ -155,17 +167,11 @@ class serverstats
/** Cpu usage at last sample
*/
timeval LastCPU;
+
/** Time last sample was read
*/
timespec LastSampled;
#endif
- /** The constructor initializes all the counts to zero
- */
- serverstats()
- : Accept(0), Refused(0), Unknown(0), Collisions(0), Dns(0),
- DnsGood(0), DnsBad(0), Connects(0), Sent(0), Recv(0)
- {
- }
};
/** The main class of the irc server.
@@ -206,7 +212,7 @@ class CoreExport InspIRCd
* hash and set its descriptor to FD_MAGIC_NUMBER so the data
* falls into the abyss :p
*/
- FakeUser* FakeClient;
+ FakeUser* FakeClient = nullptr;
/** Find a user in the UUID hash
* @param uid The UUID to find
@@ -220,7 +226,7 @@ class CoreExport InspIRCd
/** Config file pathname specified on the commandline or via ./configure
*/
- std::string ConfigFileName;
+ std::string ConfigFileName = INSPIRCD_CONFIG_PATH "/inspircd.conf";
ExtensionManager Extensions;
@@ -234,7 +240,7 @@ class CoreExport InspIRCd
/** The thread/class used to read config files in REHASH and on startup
*/
- ConfigReaderThread* ConfigThread;
+ ConfigReaderThread* ConfigThread = nullptr;
/** LogManager handles logging.
*/
@@ -256,7 +262,7 @@ class CoreExport InspIRCd
/** Server Config class, holds configuration file data
*/
- ServerConfig* Config;
+ ServerConfig* Config = nullptr;
/** Snomask manager - handles routing of snomask messages
* to opers.
@@ -269,7 +275,7 @@ class CoreExport InspIRCd
/** X-line manager. Handles G/K/Q/E-line setting, removal and matching
*/
- XLineManager* XLines;
+ XLineManager* XLines = nullptr;
/** User manager. Various methods and data associated with users.
*/
diff --git a/include/inspsocket.h b/include/inspsocket.h
index f0bdbf101..aa6194794 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -129,8 +129,6 @@ class CoreExport StreamSocket : public EventHandler
*/
typedef Container::const_iterator const_iterator;
- SendQueue() : nbytes(0) { }
-
/** Return whether the queue is empty
* @return True if the queue is empty, false otherwise
*/
@@ -220,7 +218,7 @@ class CoreExport StreamSocket : public EventHandler
/** Length, in bytes, of the sendq
*/
- size_t nbytes;
+ size_t nbytes = 0;
};
/** The type of socket this IOHook represents. */
@@ -232,13 +230,13 @@ class CoreExport StreamSocket : public EventHandler
private:
/** Whether this socket should close once its sendq is empty */
- bool closeonempty;
+ bool closeonempty = false;
/** Whether the socket is currently closing or not, used to avoid repeatedly closing a closed socket */
- bool closing;
+ bool closing = false;
/** The IOHook that handles raw I/O for this socket, or NULL */
- IOHook* iohook;
+ IOHook* iohook = nullptr;
/** Send queue of the socket
*/
@@ -290,10 +288,7 @@ class CoreExport StreamSocket : public EventHandler
public:
const Type type;
StreamSocket(Type sstype = SS_UNKNOWN)
- : closeonempty(false)
- , closing(false)
- , iohook(NULL)
- , type(sstype)
+ : type(sstype)
{
}
IOHook* GetIOHook() const;
diff --git a/include/intrusive_list.h b/include/intrusive_list.h
index 5f55591c7..d7d34e285 100644
--- a/include/intrusive_list.h
+++ b/include/intrusive_list.h
@@ -32,8 +32,8 @@ template <typename T, typename Tag = intrusive_list_def_tag> class intrusive_lis
template <typename T, typename Tag = intrusive_list_def_tag>
class intrusive_list_node
{
- T* ptr_next;
- T* ptr_prev;
+ T* ptr_next = nullptr;
+ T* ptr_prev = nullptr;
void unlink()
{
@@ -45,12 +45,6 @@ class intrusive_list_node
}
public:
- intrusive_list_node()
- : ptr_next(NULL)
- , ptr_prev(NULL)
- {
- }
-
friend class intrusive_list<T, Tag>;
friend class intrusive_list_tail<T, Tag>;
};
diff --git a/include/intrusive_list_impl.h b/include/intrusive_list_impl.h
index 7d71e3f78..2cf58485f 100644
--- a/include/intrusive_list_impl.h
+++ b/include/intrusive_list_impl.h
@@ -67,15 +67,6 @@ class INSPIRCD_INTRUSIVE_LIST_NAME
typedef iterator const_iterator;
- INSPIRCD_INTRUSIVE_LIST_NAME()
- : listhead(NULL)
-#ifdef INSPIRCD_INTRUSIVE_LIST_HAS_TAIL
- , listtail(NULL)
-#endif
- , listsize(0)
- {
- }
-
bool empty() const
{
return (size() == 0);
@@ -162,11 +153,11 @@ class INSPIRCD_INTRUSIVE_LIST_NAME
}
private:
- T* listhead;
+ T* listhead = nullptr;
#ifdef INSPIRCD_INTRUSIVE_LIST_HAS_TAIL
- T* listtail;
+ T* listtail = nullptr;
#endif
- size_t listsize;
+ size_t listsize = 0;
};
} // namespace insp
diff --git a/include/iohook.h b/include/iohook.h
index dd5acda12..b35d68dbf 100644
--- a/include/iohook.h
+++ b/include/iohook.h
@@ -115,7 +115,7 @@ class IOHookMiddle : public IOHook
/** Next IOHook in the chain
*/
- IOHook* nexthook;
+ IOHook* nexthook = nullptr;
protected:
/** Get all queued up data which has not yet been passed up the hook chain
@@ -134,7 +134,6 @@ class IOHookMiddle : public IOHook
*/
IOHookMiddle(IOHookProvider* provider)
: IOHook(provider)
- , nexthook(NULL)
{
}
diff --git a/include/logger.h b/include/logger.h
index 0c63c8d00..ab2902099 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -52,7 +52,7 @@ class CoreExport FileWriter
/** Number of write operations that have occured
*/
- unsigned int writeops;
+ unsigned int writeops = 0;
public:
/** The constructor takes an already opened logfile.
@@ -128,7 +128,7 @@ class CoreExport LogManager
private:
/** Lock variable, set to true when a log is in progress, which prevents further loggging from happening and creating a loop.
*/
- bool Logging;
+ bool Logging = false;
/** Map of active log types and what LogStreams will receive them.
*/
@@ -148,7 +148,6 @@ class CoreExport LogManager
FileLogMap FileLogs;
public:
- LogManager();
~LogManager();
/** Adds a FileWriter instance to LogManager, or increments the reference count of an existing instance.
diff --git a/include/message.h b/include/message.h
index 3a7c7018e..5631aa25f 100644
--- a/include/message.h
+++ b/include/message.h
@@ -34,10 +34,10 @@ class CoreExport MessageDetails
{
public:
/** Whether to echo the message at all. */
- bool echo;
+ bool echo = true;
/* Whether to send the original message back to clients with echo-message support. */
- bool echo_original;
+ bool echo_original = false;
/** The users who are exempted from receiving this message. */
CUList exemptions;
@@ -76,9 +76,7 @@ class CoreExport MessageDetails
protected:
MessageDetails(MessageType mt, const std::string& msg, const ClientProtocol::TagMap& tags)
- : echo(true)
- , echo_original(false)
- , original_text(msg)
+ : original_text(msg)
, tags_in(tags)
, text(msg)
, type(mt)
@@ -109,7 +107,7 @@ class CoreExport MessageTarget
public:
/** If type is TYPE_CHANNEL and the user specified a status rank. */
- char status;
+ char status = 0;
/** The type of the target of the message. If this is TYPE_CHANNEL then dest
* is a Channel*, TYPE_USER then dest is a User*, and TYPE_SERVER then dest is
@@ -133,7 +131,6 @@ class CoreExport MessageTarget
*/
MessageTarget(User* user)
: dest(user)
- , status(0)
, type(TYPE_USER)
{
}
@@ -143,7 +140,6 @@ class CoreExport MessageTarget
*/
MessageTarget(std::string* server)
: dest(server)
- , status(0)
, type(TYPE_SERVER)
{
}
diff --git a/include/mode.h b/include/mode.h
index d28a0b408..8878f9f79 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -128,7 +128,7 @@ class CoreExport ModeHandler : public ServiceProvider
* True if the mode requires oper status
* to set.
*/
- bool oper;
+ bool oper = false;
/**
* Mode is a 'list' mode. The behaviour
@@ -140,7 +140,7 @@ class CoreExport ModeHandler : public ServiceProvider
* wether your module can produce 'lists' or not
* (e.g. banlists, etc)
*/
- bool list;
+ bool list = false;
/**
* The mode type, either MODETYPE_USER or
@@ -153,10 +153,10 @@ class CoreExport ModeHandler : public ServiceProvider
const Class type_id;
/** The prefix rank required to set this mode on channels. */
- unsigned int ranktoset;
+ unsigned int ranktoset = HALFOP_VALUE;
/** The prefix rank required to unset this mode on channels. */
- unsigned int ranktounset;
+ unsigned int ranktounset = HALFOP_VALUE;
/** If non-empty then the syntax of the parameter for this mode. */
std::string syntax;
@@ -370,7 +370,7 @@ class CoreExport PrefixMode : public ModeHandler
unsigned int prefixrank;
/** Whether a client with this prefix can remove it from themself. */
- bool selfremove;
+ bool selfremove = true;
public:
/**
diff --git a/include/modules.h b/include/modules.h
index db0e7a167..91834c2db 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -66,8 +66,8 @@ enum ModuleFlags
* the compiler will inline accesses to have the same efficiency as integer operations.
*/
struct ModResult {
- int res;
- ModResult() : res(0) {}
+ int res = 0;
+ ModResult() = default;
explicit ModResult(int r) : res(r) {}
inline bool operator==(const ModResult& r) const
{
@@ -246,18 +246,12 @@ class CoreExport Module : public classbase, public usecountbase
/** Reference to the dlopen() value
*/
- DLLManager* ModuleDLLManager;
+ DLLManager* ModuleDLLManager = nullptr;
/** If true, this module will be unloaded soon, further unload attempts will fail
* Value is used by the ModuleManager internally, you should not modify it
*/
- bool dying;
-
- /** Default constructor.
- * Creates a module class. Don't do any type of hook registration or checks
- * for other modules here; do that in init().
- */
- Module();
+ bool dying = false;
/** Module setup
* \exception ModuleException Throwing this class, or any class derived from ModuleException, causes loading of the module to abort.
diff --git a/include/modules/cap.h b/include/modules/cap.h
index 8ae5df5c7..d5119b10f 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -130,7 +130,7 @@ namespace Cap
/** True if the cap is active. Only active caps are registered in the manager.
*/
- bool active;
+ bool active = true;
/** Reference to the cap manager object
*/
@@ -172,7 +172,6 @@ namespace Cap
*/
Capability(Module* mod, const std::string& Name)
: ServiceProvider(mod, Name, SERVICE_CUSTOM)
- , active(true)
, manager(mod, "capmanager")
{
Unregister();
diff --git a/include/modules/ctctags.h b/include/modules/ctctags.h
index f1af43c09..f51e5345f 100644
--- a/include/modules/ctctags.h
+++ b/include/modules/ctctags.h
@@ -80,10 +80,10 @@ class CTCTags::TagMessageDetails
{
public:
/** Whether to echo the tags at all. */
- bool echo;
+ bool echo = true;
/* Whether to send the original tags back to clients with echo-message support. */
- bool echo_original;
+ bool echo_original = false;
/** The users who are exempted from receiving this message. */
CUList exemptions;
@@ -95,9 +95,7 @@ class CTCTags::TagMessageDetails
ClientProtocol::TagMap tags_out;
TagMessageDetails(const ClientProtocol::TagMap& tags)
- : echo(true)
- , echo_original(false)
- , tags_in(tags)
+ : tags_in(tags)
{
}
};
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 00d50ffb8..4fc3ae295 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -103,23 +103,36 @@ namespace DNS
struct ResourceRecord : Question
{
- unsigned int ttl;
+ unsigned int ttl = 0;
std::string rdata;
time_t created;
- ResourceRecord(const std::string& n, QueryType t) : Question(n, t), ttl(0), created(ServerInstance->Time()) { }
- ResourceRecord(const Question& question) : Question(question), ttl(0), created(ServerInstance->Time()) { }
+ ResourceRecord(const std::string& n, QueryType t)
+ : Question(n, t)
+ , created(ServerInstance->Time())
+ {
+ }
+
+ ResourceRecord(const Question& question)
+ : Question(question)
+ , created(ServerInstance->Time())
+ {
+ }
};
struct Query
{
Question question;
std::vector<ResourceRecord> answers;
- Error error;
- bool cached;
+ Error error = ERROR_NONE;
+ bool cached = false;
+
+ Query() = default;
- Query() : error(ERROR_NONE), cached(false) { }
- Query(const Question& q) : question(q), error(ERROR_NONE), cached(false) { }
+ Query(const Question& q)
+ : question(q)
+ {
+ }
const ResourceRecord* FindAnswerOfType(QueryType qtype) const
{
@@ -161,7 +174,7 @@ namespace DNS
/* Use result cache if available */
bool use_cache;
/* Request id */
- RequestId id;
+ RequestId id = 0;
/* Creator of this request */
Module* const creator;
@@ -170,7 +183,6 @@ namespace DNS
, manager(mgr)
, question(addr, qt)
, use_cache(usecache)
- , id(0)
, creator(mod)
{
}
diff --git a/include/modules/invite.h b/include/modules/invite.h
index ba76f577e..5786f7dc3 100644
--- a/include/modules/invite.h
+++ b/include/modules/invite.h
@@ -113,7 +113,7 @@ class Invite::Invite : public insp::intrusive_list_node<Invite, LocalUser>, publ
private:
/** Timer handling expiration. If NULL this invite doesn't expire.
*/
- Timer* expiretimer;
+ Timer* expiretimer = nullptr;
/** Constructor, only available to the module providing the invite API (core_channel).
* To create Invites use InviteAPI::Create().
diff --git a/include/modules/ircv3_batch.h b/include/modules/ircv3_batch.h
index 6f86b5f29..9e64c4fcc 100644
--- a/include/modules/ircv3_batch.h
+++ b/include/modules/ircv3_batch.h
@@ -83,14 +83,14 @@ class IRCv3::Batch::Manager : public DataProvider, public ClientProtocol::Messag
*/
class IRCv3::Batch::Batch
{
- Manager* manager;
+ Manager* manager = nullptr;
const std::string type;
RefTag reftag;
std::string reftagstr;
unsigned int bit;
- BatchInfo* batchinfo;
- ClientProtocol::Message* batchstartmsg;
- ClientProtocol::Message* batchendmsg;
+ BatchInfo* batchinfo = nullptr;
+ ClientProtocol::Message* batchstartmsg = nullptr;
+ ClientProtocol::Message* batchendmsg = nullptr;
void Setup(unsigned int b)
{
@@ -108,10 +108,7 @@ class IRCv3::Batch::Batch
* @param Type Batch type string, used to indicate what kind of grouping the batch does. May be empty.
*/
Batch(const std::string& Type)
- : manager(NULL)
- , type(Type)
- , batchinfo(NULL)
- , batchstartmsg(NULL)
+ : type(Type)
{
}
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 88a6751e4..813186650 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -45,9 +45,10 @@ class ssl_cert : public refcountbase
std::string issuer;
std::string error;
std::string fingerprint;
- bool trusted, invalid, unknownsigner, revoked;
-
- ssl_cert() : trusted(false), invalid(true), unknownsigner(true), revoked(false) {}
+ bool trusted = false;
+ bool invalid = true;
+ bool unknownsigner = true;
+ bool revoked = false;
/** Get certificate distinguished name
* @return Certificate DN
diff --git a/include/modules/who.h b/include/modules/who.h
index 36aecbc03..e1f57d149 100644
--- a/include/modules/who.h
+++ b/include/modules/who.h
@@ -55,7 +55,7 @@ class Who::Request
std::bitset<UCHAR_MAX> flags;
/** Whether we are matching using a wildcard or a flag. */
- bool fuzzy_match;
+ bool fuzzy_match = false;
/** The text to match against. */
std::string matchtext;
@@ -64,7 +64,7 @@ class Who::Request
std::vector<Numeric::Numeric> results;
/** Whether the source requested a WHOX response. */
- bool whox;
+ bool whox = false;
/** The fields to include in the WHOX response. */
std::bitset<UCHAR_MAX> whox_fields;
@@ -84,9 +84,5 @@ class Who::Request
virtual bool GetFieldIndex(char flag, size_t& out) const = 0;
protected:
- Request()
- : fuzzy_match(false)
- , whox(false)
- {
- }
+ Request() = default;
};
diff --git a/include/numeric.h b/include/numeric.h
index df67bbd6d..b6069e85e 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -39,7 +39,7 @@ class Numeric::Numeric
/** Source server of the numeric, if NULL (the default) then it is the local server
*/
- Server* sourceserver;
+ Server* sourceserver = nullptr;
public:
/** Constructor
@@ -47,7 +47,6 @@ class Numeric::Numeric
*/
Numeric(unsigned int num)
: numeric(num)
- , sourceserver(NULL)
{
}
diff --git a/include/numericbuilder.h b/include/numericbuilder.h
index 73bcc2c97..d25b10a5a 100644
--- a/include/numericbuilder.h
+++ b/include/numericbuilder.h
@@ -143,7 +143,7 @@ class Numeric::GenericParamBuilder
{
Sink sink;
Numeric numeric;
- std::string::size_type currlen;
+ std::string::size_type currlen = 0;
std::string::size_type max;
bool HasRoom(const std::string::size_type additional) const
@@ -155,7 +155,6 @@ class Numeric::GenericParamBuilder
GenericParamBuilder(Sink s, unsigned int num, size_t additionalsize)
: sink(s)
, numeric(num)
- , currlen(0)
, max(ServerInstance->Config->Limits.MaxLine - ServerInstance->Config->ServerName.size() - additionalsize - 10)
{
}
diff --git a/include/server.h b/include/server.h
index 0aa9ee08f..23c89d2c4 100644
--- a/include/server.h
+++ b/include/server.h
@@ -38,11 +38,11 @@ class CoreExport Server : public classbase
/** True if this server is ulined
*/
- bool uline;
+ bool uline = false;
/** True if this server is a silent uline, i.e. silent="true" in the uline block
*/
- bool silentuline;
+ bool silentuline = false;
/** Allow ConfigReaderThread to update the description on a rehash
*/
@@ -53,8 +53,6 @@ class CoreExport Server : public classbase
: id(srvid)
, name(srvname)
, description(srvdesc)
- , uline(false)
- , silentuline(false)
{
}
diff --git a/include/snomasks.h b/include/snomasks.h
index 342206a14..be090c73d 100644
--- a/include/snomasks.h
+++ b/include/snomasks.h
@@ -39,7 +39,7 @@ class Snomask
*/
std::string LastMessage;
char LastLetter;
- unsigned int Count;
+ unsigned int Count = 0;
/** Log and send a message to all opers who have the given snomask set
* @param letter The target users of this message
@@ -49,10 +49,6 @@ class Snomask
static void Send(char letter, const std::string& desc, const std::string& msg);
public:
- /** Create a new Snomask
- */
- Snomask();
-
/** Sends a message to all opers with this snomask.
* @param message The message to send
* @param letter The snomask character to send the message to.
diff --git a/include/socketengine.h b/include/socketengine.h
index e54dfca97..0d0108038 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -232,20 +232,15 @@ class CoreExport SocketEngine
*/
class Statistics
{
- mutable size_t indata;
- mutable size_t outdata;
- mutable time_t lastempty;
+ mutable size_t indata = 0;
+ mutable size_t outdata = 0;
+ mutable time_t lastempty = 0;
/** Reset the byte counters and lastempty if there wasn't a reset in this second.
*/
void CheckFlush() const;
public:
- /** Constructor, initializes member vars except indata and outdata because those are set to 0
- * in CheckFlush() the first time Update() or GetBandwidth() is called.
- */
- Statistics() : lastempty(0), TotalEvents(0), ReadEvents(0), WriteEvents(0), ErrorEvents(0) { }
-
/** Update counters for network data received.
* This should be called after every read-type syscall.
* @param len_in Number of bytes received, or -1 for error, as typically
@@ -267,10 +262,10 @@ class CoreExport SocketEngine
*/
void CoreExport GetBandwidth(float& kbitpersec_in, float& kbitpersec_out, float& kbitpersec_total) const;
- unsigned long TotalEvents;
- unsigned long ReadEvents;
- unsigned long WriteEvents;
- unsigned long ErrorEvents;
+ unsigned long TotalEvents = 0;
+ unsigned long ReadEvents = 0;
+ unsigned long WriteEvents = 0;
+ unsigned long ErrorEvents = 0;
};
private:
diff --git a/include/usermanager.h b/include/usermanager.h
index c8d426179..bc1c6fe3b 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -33,9 +33,8 @@ class CoreExport UserManager
public:
struct CloneCounts
{
- unsigned int global;
- unsigned int local;
- CloneCounts() : global(0), local(0) { }
+ unsigned int global = 0;
+ unsigned int local = 0;
};
/** Container that maps IP addresses to clone counts
diff --git a/include/users.h b/include/users.h
index 4fa25bb77..f631d4da3 100644
--- a/include/users.h
+++ b/include/users.h
@@ -80,7 +80,7 @@ struct CoreExport ConnectClass : public refcountbase
char type;
/** True if this class uses fake lag to manage flood, false if it kills */
- bool fakelag;
+ bool fakelag = true;
/** Connect class name
*/
@@ -88,7 +88,7 @@ struct CoreExport ConnectClass : public refcountbase
/** Max time to register the connection in seconds
*/
- unsigned int registration_timeout;
+ unsigned int registration_timeout = 0;
/** Host mask for this line
*/
@@ -96,53 +96,53 @@ struct CoreExport ConnectClass : public refcountbase
/** Number of seconds between pings for this line
*/
- unsigned int pingtime;
+ unsigned int pingtime = 0;
/** Maximum size of sendq for users in this class (bytes)
* Users cannot send commands if they go over this limit
*/
- unsigned long softsendqmax;
+ unsigned long softsendqmax = 0;
/** Maximum size of sendq for users in this class (bytes)
* Users are killed if they go over this limit
*/
- unsigned long hardsendqmax;
+ unsigned long hardsendqmax = 0;
/** Maximum size of recvq for users in this class (bytes)
*/
- unsigned long recvqmax;
+ unsigned long recvqmax = 0;
/** Seconds worth of penalty before penalty system activates
*/
- unsigned int penaltythreshold;
+ unsigned int penaltythreshold = 0;
/** Maximum rate of commands (units: millicommands per second) */
- unsigned int commandrate;
+ unsigned int commandrate = 0;
/** Local max when connecting by this connection class
*/
- unsigned long maxlocal;
+ unsigned long maxlocal = 0;
/** Global max when connecting by this connection class
*/
- unsigned long maxglobal;
+ unsigned long maxglobal = 0;
/** True if max connections for this class is hit and a warning is wanted
*/
- bool maxconnwarn;
+ bool maxconnwarn = true;
/** Max channels for this class
*/
- unsigned int maxchans;
+ unsigned int maxchans = 20;
/** How many users may be in this connect class before they are refused?
* (0 = no limit = default)
*/
- unsigned long limit;
+ unsigned long limit = 0;
/** If set to true, no user DNS lookups are to be performed
*/
- bool resolvehostnames;
+ bool resolvehostnames = true;
/**
* If non-empty the server ports which this user has to be using
@@ -296,7 +296,7 @@ class CoreExport User : public Extensible
* may be different from the time the user's classbase object was
* created.
*/
- time_t signon;
+ time_t signon = 0;
/** Client address that the user is connected from.
* Do not modify this value directly, use SetClientIP() to change it.
@@ -668,23 +668,23 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
/** Serializer to use when communicating with the user
*/
- ClientProtocol::Serializer* serializer;
+ ClientProtocol::Serializer* serializer = nullptr;
/** Stats counter for bytes inbound
*/
- unsigned int bytes_in;
+ unsigned int bytes_in = 0;
/** Stats counter for bytes outbound
*/
- unsigned int bytes_out;
+ unsigned int bytes_out = 0;
/** Stats counter for commands inbound
*/
- unsigned int cmds_in;
+ unsigned int cmds_in = 0;
/** Stats counter for commands outbound
*/
- unsigned int cmds_out;
+ unsigned int cmds_out = 0;
/** Password specified by the user when they registered (if any).
* This is stored even if the \<connect> block doesnt need a password, so that
@@ -724,18 +724,18 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
unsigned int exempt:1;
/** The time at which this user should be pinged next. */
- time_t nextping;
+ time_t nextping = 0;
/** Time that the connection last sent a message, used to calculate idle time
*/
- time_t idle_lastmsg;
+ time_t idle_lastmsg = 0;
/** This value contains how far into the penalty threshold the user is.
* This is used either to enable fake lag or for excess flood quits
*/
- unsigned int CommandFloodPenalty;
+ unsigned int CommandFloodPenalty = 0;
- already_sent_t already_sent;
+ already_sent_t already_sent = 0;
/** Check if the user matches a G- or K-line, and disconnect them if they do.
* @param doZline True if Z-lines should be checked (if IP has changed since initial connect)
diff --git a/include/xline.h b/include/xline.h
index a01e846d7..251afe959 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -59,7 +59,6 @@ class CoreExport XLine : public classbase
, source(src)
, reason(re)
, type(t)
- , from_config(false)
{
expiry = set_time + duration;
}
@@ -150,7 +149,7 @@ class CoreExport XLine : public classbase
const std::string type;
// Whether this XLine was loaded from the server config.
- bool from_config;
+ bool from_config = false;
virtual bool IsBurstable();
};