1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 18:23:13 +02:00

Use C++11 default initializers and destructors where possible.

This commit is contained in:
Sadie Powell
2022-01-03 18:52:15 +00:00
parent 7531e90499
commit a31a7f5a6c
34 changed files with 52 additions and 93 deletions
+3 -3
View File
@@ -665,7 +665,7 @@ class CoreException : public std::exception
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~CoreException() throw() { }
virtual ~CoreException() throw() = default;
/** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure.
*/
@@ -694,7 +694,7 @@ class ModuleException : public CoreException
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~ModuleException() throw() { }
virtual ~ModuleException() throw() = default;
};
class ConvertException : public CoreException
@@ -702,7 +702,7 @@ class ConvertException : public CoreException
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() throw() { }
virtual ~ConvertException() throw() = default;
};
/** Convert something to a string
+1 -1
View File
@@ -36,7 +36,7 @@ class ReferenceBase
public:
ReferenceBase() = default;
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
virtual ~ReferenceBase() { }
virtual ~ReferenceBase() = default;
inline void Invalidate() { this->invalid = true; }
};
+2 -2
View File
@@ -43,7 +43,7 @@ struct CommandInfo
*/
struct CoreExport CommandReply
{
virtual ~CommandReply() { }
virtual ~CommandReply() = default;
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
};
@@ -118,7 +118,7 @@ class CoreExport Command : public Service
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
public:
virtual ~Command();
virtual ~Command() = default;
protected:
void SetDesc(const Anope::string &d);
+1 -1
View File
@@ -178,7 +178,7 @@ class ConfigException : public CoreException
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~ConfigException() throw() { }
virtual ~ConfigException() throw() = default;
};
extern Configuration::File ServicesConf;
+1 -1
View File
@@ -39,7 +39,7 @@ class CoreExport NumberList
/** Destructor, does nothing
*/
virtual ~NumberList();
virtual ~NumberList() = default;
/** Should be called after the constructors are done running. This calls the callbacks.
*/
+2 -2
View File
@@ -55,7 +55,7 @@ class CoreExport Mode : public Base
* @param type The mode type
*/
Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
virtual ~Mode();
virtual ~Mode() = default;
/** Can a user set this mode, used for mlock
* @param u The user
@@ -229,7 +229,7 @@ class CoreExport ChannelStatus
{
Anope::string modes;
public:
ChannelStatus();
ChannelStatus() = default;
ChannelStatus(const Anope::string &modes);
void AddMode(char c);
void DelMode(char c);
+3 -3
View File
@@ -30,14 +30,14 @@ struct BadWord
Anope::string word;
BadWordType type;
virtual ~BadWord() { }
virtual ~BadWord() = default;
protected:
BadWord() { }
BadWord() = default;
};
struct BadWords
{
virtual ~BadWords() { }
virtual ~BadWords() = default;
/** Add a badword to the badword list
* @param word The badword
+2 -2
View File
@@ -36,9 +36,9 @@ struct KickerData
bool dontkickops, dontkickvoices;
protected:
KickerData() { }
KickerData() = default;
public:
virtual ~KickerData() { }
virtual ~KickerData() = default;
virtual void Check(ChannelInfo *ci) = 0;
};
+2 -2
View File
@@ -13,9 +13,9 @@ struct EntryMsg
Anope::string message;
time_t when;
virtual ~EntryMsg() { }
virtual ~EntryMsg() = default;
protected:
EntryMsg() { }
EntryMsg() = default;
};
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
+3 -3
View File
@@ -22,9 +22,9 @@ struct LogSetting
Anope::string creator;
time_t created;
virtual ~LogSetting() { }
virtual ~LogSetting() = default;
protected:
LogSetting() { }
LogSetting() = default;
};
struct LogSettings : Serialize::Checker<std::vector<LogSetting *> >
@@ -37,6 +37,6 @@ struct LogSettings : Serialize::Checker<std::vector<LogSetting *> >
}
public:
virtual ~LogSettings() { }
virtual ~LogSettings() = default;
virtual LogSetting *Create() = 0;
};
+3 -3
View File
@@ -18,16 +18,16 @@ struct ModeLock
Anope::string setter;
time_t created;
virtual ~ModeLock() { }
virtual ~ModeLock() = default;
protected:
ModeLock() { }
ModeLock() = default;
};
struct ModeLocks
{
typedef std::vector<ModeLock *> ModeList;
virtual ~ModeLocks() { }
virtual ~ModeLocks() = default;
/** Check if a mode is mlocked
* @param mode The mode
+1 -1
View File
@@ -118,7 +118,7 @@ namespace DNS
{
public:
Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { }
virtual ~Manager() { }
virtual ~Manager() = default;
virtual void Process(Request *req) = 0;
virtual void RemoveRequest(Request *req) = 0;
+2 -2
View File
@@ -17,7 +17,7 @@ namespace Encryption
class Context
{
public:
virtual ~Context() { }
virtual ~Context() = default;
virtual void Update(const unsigned char *data, size_t len) = 0;
virtual void Finalize() = 0;
virtual Hash GetFinalizedHash() = 0;
@@ -27,7 +27,7 @@ namespace Encryption
{
public:
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
virtual ~Provider() { }
virtual ~Provider() = default;
virtual Context *CreateContext(IV * = NULL) = 0;
virtual IV GetDefaultIV() = 0;
+2 -2
View File
@@ -14,7 +14,7 @@ class LDAPException : public ModuleException
public:
LDAPException(const Anope::string &reason) : ModuleException(reason) { }
virtual ~LDAPException() throw() { }
virtual ~LDAPException() throw() = default;
};
struct LDAPModification
@@ -116,7 +116,7 @@ class LDAPInterface
Module *owner;
LDAPInterface(Module *m) : owner(m) { }
virtual ~LDAPInterface() { }
virtual ~LDAPInterface() = default;
virtual void OnResult(const LDAPResult &r) = 0;
virtual void OnError(const LDAPResult &err) = 0;
+2 -2
View File
@@ -12,9 +12,9 @@
struct NSCertList
{
protected:
NSCertList() { }
NSCertList() = default;
public:
virtual ~NSCertList() { }
virtual ~NSCertList() = default;
/** Add an entry to the nick's certificate list
*
+1 -1
View File
@@ -27,7 +27,7 @@ struct ForbidData
time_t expires = 0;
ForbidType type;
virtual ~ForbidData() { }
virtual ~ForbidData() = default;
protected:
ForbidData() = default;
};
+1 -1
View File
@@ -16,7 +16,7 @@ struct IgnoreData
Anope::string reason;
time_t time = 0; /* When do we stop ignoring them? */
virtual ~IgnoreData() { }
virtual ~IgnoreData() = default;
protected:
IgnoreData() = default;
};
+1 -1
View File
@@ -47,7 +47,7 @@ namespace Redis
Module *owner;
Interface(Module *m) : owner(m) { }
virtual ~Interface() { }
virtual ~Interface() = default;
virtual void OnResult(const Reply &r) = 0;
virtual void OnError(const Anope::string &error) { Log(owner) << error; }
+3 -2
View File
@@ -12,6 +12,7 @@ struct MiscData
Anope::string name;
Anope::string data;
MiscData() { }
virtual ~MiscData() { }
virtual ~MiscData() = default;
protected:
MiscData() = default;
};
+2 -2
View File
@@ -82,7 +82,7 @@ namespace SQL
public:
Exception(const Anope::string &reason) : ModuleException(reason) { }
virtual ~Exception() throw() { }
virtual ~Exception() throw() = default;
};
/** A SQL query
@@ -187,7 +187,7 @@ namespace SQL
Module *owner;
Interface(Module *m) : owner(m) { }
virtual ~Interface() { }
virtual ~Interface() = default;
virtual void OnResult(const Result &r) = 0;
virtual void OnError(const Result &r) = 0;
+2 -2
View File
@@ -14,6 +14,6 @@ struct SuspendInfo
Anope::string what, by, reason;
time_t when, expires;
SuspendInfo() { }
virtual ~SuspendInfo() { }
SuspendInfo() = default;
virtual ~SuspendInfo() = default;
};
+1 -1
View File
@@ -28,7 +28,7 @@ class XMLRPCServiceInterface;
class XMLRPCEvent
{
public:
virtual ~XMLRPCEvent() { }
virtual ~XMLRPCEvent() = default;
virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
};
+2 -2
View File
@@ -21,7 +21,7 @@ class RegexException : public CoreException
public:
RegexException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~RegexException() throw() { }
virtual ~RegexException() throw() = default;
};
class CoreExport Regex
@@ -30,7 +30,7 @@ class CoreExport Regex
protected:
Regex(const Anope::string &expr) : expression(expr) { }
public:
virtual ~Regex() { }
virtual ~Regex() = default;
const Anope::string &GetExpression() { return expression; }
virtual bool Matches(const Anope::string &str) = 0;
};
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Serialize
DT_INT
};
virtual ~Data() { }
virtual ~Data() = default;
virtual std::iostream& operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
+1 -1
View File
@@ -122,7 +122,7 @@ class ServiceReference : public Reference<T>
Anope::string name;
public:
ServiceReference() { }
ServiceReference() = default;
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
{
+5 -7
View File
@@ -126,7 +126,7 @@ class SocketException : public CoreException
/** Destructor
* @throws Nothing
*/
virtual ~SocketException() throw() { }
virtual ~SocketException() throw() = default;
};
enum SocketFlag
@@ -144,7 +144,7 @@ enum SocketFlag
class CoreExport SocketIO
{
public:
virtual ~SocketIO() { }
virtual ~SocketIO() = default;
/** Receive something from the buffer
* @param s The socket
@@ -285,8 +285,7 @@ class CoreExport BufferedSocket : public virtual Socket
int recv_len;
public:
BufferedSocket();
virtual ~BufferedSocket();
virtual ~BufferedSocket() = default;
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
@@ -339,8 +338,7 @@ class CoreExport BinarySocket : public virtual Socket
std::deque<DataBlock *> write_buffer;
public:
BinarySocket();
virtual ~BinarySocket();
virtual ~BinarySocket() = default;
/** Called when there is something to be received for this socket
* @return true on success, false to drop this socket
@@ -377,7 +375,7 @@ class CoreExport ListenSocket : public virtual Socket
* @param ipv6 true for ipv6
*/
ListenSocket(const Anope::string &bindip, int port, bool ipv6);
virtual ~ListenSocket();
virtual ~ListenSocket() = default;
/** Process what has come in from the connection
* @return false to destroy this socket
+1 -1
View File
@@ -27,7 +27,7 @@ class CoreExport Thread : public Pipe, public Extensible
/** Threads destructor
*/
virtual ~Thread();
virtual ~Thread() = default;
/** Join to the thread, sets the exit state to true
*/
+1 -1
View File
@@ -453,7 +453,7 @@ namespace DNS
class ReplySocket : public virtual Socket
{
public:
virtual ~ReplySocket() { }
virtual ~ReplySocket() = default;
virtual void Reply(Packet *p) = 0;
};
}
-4
View File
@@ -122,10 +122,6 @@ Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t
allow_unregistered = require_user = false;
}
Command::~Command()
{
}
void Command::SetDesc(const Anope::string &d)
{
this->desc = d;
-4
View File
@@ -90,10 +90,6 @@ NumberList::NumberList(const Anope::string &list, bool descending) : desc(descen
} while (sep.GetToken(token));
}
NumberList::~NumberList()
{
}
void NumberList::Process()
{
if (!is_valid)
-8
View File
@@ -56,10 +56,6 @@ struct StackerInfo
void AddMode(Mode *mode, bool set, const Anope::string &param);
};
ChannelStatus::ChannelStatus()
{
}
ChannelStatus::ChannelStatus(const Anope::string &m) : modes(m)
{
}
@@ -116,10 +112,6 @@ Mode::Mode(const Anope::string &mname, ModeClass mcl, char mch, ModeType mt) : n
{
}
Mode::~Mode()
{
}
bool Mode::CanSet(User *u) const
{
return true;
-16
View File
@@ -13,14 +13,6 @@
#include "sockets.h"
#include "socketengine.h"
BufferedSocket::BufferedSocket()
{
}
BufferedSocket::~BufferedSocket()
{
}
bool BufferedSocket::ProcessRead()
{
char tbuffer[NET_BUFSIZE];
@@ -115,14 +107,6 @@ BinarySocket::DataBlock::~DataBlock()
delete [] this->orig;
}
BinarySocket::BinarySocket()
{
}
BinarySocket::~BinarySocket()
{
}
bool BinarySocket::ProcessRead()
{
char tbuffer[NET_BUFSIZE];
-4
View File
@@ -567,10 +567,6 @@ ListenSocket::ListenSocket(const Anope::string &bindip, int port, bool i)
throw SocketException("Unable to listen: " + Anope::LastError());
}
ListenSocket::~ListenSocket()
{
}
bool ListenSocket::ProcessRead()
{
try
-4
View File
@@ -44,10 +44,6 @@ static void *entry_point(void *parameter)
return NULL;
}
Thread::~Thread()
{
}
void Thread::Join()
{
this->SetExitState();