aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/base.h2
-rw-r--r--include/channels.h4
-rw-r--r--include/clientprotocol.h50
-rw-r--r--include/clientprotocolmsg.h12
-rw-r--r--include/command_parse.h6
-rw-r--r--include/configreader.h2
-rw-r--r--include/dynref.h2
-rw-r--r--include/inspircd.h10
-rw-r--r--include/inspsocket.h2
-rw-r--r--include/intrusive_list.h2
-rw-r--r--include/intrusive_list_impl.h2
-rw-r--r--include/iohook.h2
-rw-r--r--include/listmode.h2
-rw-r--r--include/mode.h12
-rw-r--r--include/modules.h2
-rw-r--r--include/modules/cap.h8
-rw-r--r--include/modules/dns.h2
-rw-r--r--include/modules/invite.h4
-rw-r--r--include/modules/ircv3_batch.h2
-rw-r--r--include/modules/ssl.h4
-rw-r--r--include/protocol.h4
-rw-r--r--include/socket.h2
-rw-r--r--include/stdalgo.h2
-rw-r--r--include/typedefs.h2
-rw-r--r--include/usermanager.h2
-rw-r--r--src/bancache.cpp8
-rw-r--r--src/base.cpp4
-rw-r--r--src/channels.cpp26
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/configparser.cpp8
-rw-r--r--src/coremods/core_channel/cmd_kick.cpp2
-rw-r--r--src/coremods/core_channel/cmode_k.cpp2
-rw-r--r--src/coremods/core_channel/core_channel.cpp6
-rw-r--r--src/coremods/core_channel/invite.cpp8
-rw-r--r--src/coremods/core_dns.cpp4
-rw-r--r--src/coremods/core_message.cpp6
-rw-r--r--src/coremods/core_mode.cpp2
-rw-r--r--src/coremods/core_oper/cmd_kill.cpp2
-rw-r--r--src/coremods/core_reloadmodule.cpp8
-rw-r--r--src/coremods/core_who.cpp2
-rw-r--r--src/coremods/core_whowas.cpp2
-rw-r--r--src/coremods/core_xline/core_xline.cpp6
-rw-r--r--src/dynamic.cpp12
-rw-r--r--src/inspircd.cpp12
-rw-r--r--src/inspsocket.cpp14
-rw-r--r--src/listensocket.cpp2
-rw-r--r--src/mode.cpp18
-rw-r--r--src/modulemanager.cpp6
-rw-r--r--src/modules.cpp14
-rw-r--r--src/modules/extra/m_argon2.cpp2
-rw-r--r--src/modules/extra/m_geo_maxmind.cpp14
-rw-r--r--src/modules/extra/m_ldap.cpp38
-rw-r--r--src/modules/extra/m_mysql.cpp4
-rw-r--r--src/modules/extra/m_pgsql.cpp10
-rw-r--r--src/modules/extra/m_regex_posix.cpp4
-rw-r--r--src/modules/extra/m_sqlite3.cpp6
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp12
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp14
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp22
-rw-r--r--src/modules/extra/m_sslrehashsignal.cpp2
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_autoop.cpp4
-rw-r--r--src/modules/m_banredirect.cpp2
-rw-r--r--src/modules/m_callerid.cpp6
-rw-r--r--src/modules/m_cap.cpp2
-rw-r--r--src/modules/m_chanfilter.cpp10
-rw-r--r--src/modules/m_channames.cpp2
-rw-r--r--src/modules/m_clearchan.cpp2
-rw-r--r--src/modules/m_cloaking.cpp2
-rw-r--r--src/modules/m_connectban.cpp2
-rw-r--r--src/modules/m_denychans.cpp2
-rw-r--r--src/modules/m_exemptchanops.cpp2
-rw-r--r--src/modules/m_filter.cpp16
-rw-r--r--src/modules/m_gateway.cpp4
-rw-r--r--src/modules/m_geoban.cpp6
-rw-r--r--src/modules/m_geoclass.cpp2
-rw-r--r--src/modules/m_hidemode.cpp6
-rw-r--r--src/modules/m_httpd.cpp2
-rw-r--r--src/modules/m_ircv3_batch.cpp4
-rw-r--r--src/modules/m_ircv3_capnotify.cpp4
-rw-r--r--src/modules/m_ircv3_ctctags.cpp4
-rw-r--r--src/modules/m_ircv3_labeledresponse.cpp2
-rw-r--r--src/modules/m_monitor.cpp8
-rw-r--r--src/modules/m_namedmodes.cpp2
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_operprefix.cpp4
-rw-r--r--src/modules/m_password_hash.cpp2
-rw-r--r--src/modules/m_rline.cpp6
-rw-r--r--src/modules/m_rmode.cpp4
-rw-r--r--src/modules/m_samode.cpp2
-rw-r--r--src/modules/m_satopic.cpp2
-rw-r--r--src/modules/m_spanningtree/addline.cpp4
-rw-r--r--src/modules/m_spanningtree/encap.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp10
-rw-r--r--src/modules/m_spanningtree/fmode.cpp4
-rw-r--r--src/modules/m_spanningtree/ijoin.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/main.h2
-rw-r--r--src/modules/m_spanningtree/metadata.cpp2
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp4
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp2
-rw-r--r--src/modules/m_spanningtree/server.cpp10
-rw-r--r--src/modules/m_spanningtree/servercommand.cpp2
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket.h2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
-rw-r--r--src/modules/m_spanningtree/uid.cpp4
-rw-r--r--src/modules/m_spanningtree/utils.cpp12
-rw-r--r--src/modules/m_spanningtree/utils.h2
-rw-r--r--src/modules/m_sslinfo.cpp6
-rw-r--r--src/modules/m_starttls.cpp2
-rw-r--r--src/modules/m_timedbans.cpp2
-rw-r--r--src/modules/m_websocket.cpp2
-rw-r--r--src/modules/m_xline_db.cpp2
-rw-r--r--src/server.cpp2
-rw-r--r--src/socketengine.cpp8
-rw-r--r--src/socketengines/kqueue.cpp6
-rw-r--r--src/threadsocket.cpp4
-rw-r--r--src/usermanager.cpp2
-rw-r--r--src/users.cpp12
-rw-r--r--src/xline.cpp12
-rw-r--r--win/inspircd_win32wrapper.cpp2
-rw-r--r--win/inspircd_win32wrapper.h2
-rw-r--r--win/win32service.cpp16
124 files changed, 362 insertions, 362 deletions
diff --git a/include/base.h b/include/base.h
index f1fd1dbff..a2fb9f06a 100644
--- a/include/base.h
+++ b/include/base.h
@@ -116,7 +116,7 @@ public:
return *this;
}
- inline operator bool() const { return (value != NULL); }
+ inline operator bool() const { return (value != nullptr); }
inline operator T*() const { return value; }
inline T* operator->() const { return value; }
inline T& operator*() const { return *value; }
diff --git a/include/channels.h b/include/channels.h
index 3df64a060..4170ce34b 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -146,7 +146,7 @@ public:
* @param setter Setter string, may be used when the original setter is no longer online.
* If omitted or NULL, the setter string is obtained from the user.
*/
- void SetTopic(User* user, const std::string& topic, time_t topicts, const std::string* setter = NULL);
+ void SetTopic(User* user, const std::string& topic, time_t topicts, const std::string* setter = nullptr);
/** Obtain the channel "user counter"
* This returns the number of users on this channel
@@ -233,7 +233,7 @@ public:
* @param created_by_local True if this channel was just created by a local user (passed to modules in the OnUserJoin hook)
* @return A newly created Membership object, or NULL if the user was already inside the channel or if the user is a server user
*/
- Membership* ForceJoin(User* user, const std::string* privs = NULL, bool bursting = false, bool created_by_local = false);
+ Membership* ForceJoin(User* user, const std::string* privs = nullptr, bool bursting = false, bool created_by_local = false);
/** Write to all users on a channel except some users
* @param protoev Event to send, may contain any number of messages.
diff --git a/include/clientprotocol.h b/include/clientprotocol.h
index 578b24abb..5aab4b0a3 100644
--- a/include/clientprotocol.h
+++ b/include/clientprotocol.h
@@ -101,7 +101,7 @@ public:
* @param Sourceuser User to set as source of the message. If NULL, the message won't have a source when serialized.
* Optional, defaults to NULL.
*/
- MessageSource(User* Sourceuser = NULL)
+ MessageSource(User* Sourceuser = nullptr)
{
SetSourceUser(Sourceuser);
}
@@ -113,7 +113,7 @@ public:
* if provided it may be used internally, for example to create message tags.
* Useful when the source string is synthesized but it is still related to a User.
*/
- MessageSource(const std::string& Sourcestr, User* Sourceuser = NULL)
+ MessageSource(const std::string& Sourcestr, User* Sourceuser = nullptr)
{
SetSource(Sourcestr, Sourceuser);
}
@@ -128,7 +128,7 @@ public:
return sourcestr;
if (sourceuser)
return &sourceuser->GetFullHost();
- return NULL;
+ return nullptr;
}
/** Get the source User.
@@ -144,7 +144,7 @@ public:
void SetSourceUser(User* Sourceuser)
{
sourceuser = Sourceuser;
- sourcestr = NULL;
+ sourcestr = nullptr;
}
/** Set the source string and optionally source user.
@@ -153,7 +153,7 @@ public:
* as this object is alive.
* @param Sourceuser Source user to set, optional.
*/
- void SetSource(const std::string& Sourcestr, User* Sourceuser = NULL)
+ void SetSource(const std::string& Sourcestr, User* Sourceuser = nullptr)
{
sourcestr = &Sourcestr;
sourceuser = Sourceuser;
@@ -240,14 +240,14 @@ public:
}
Param(int, const char* s)
- : ptr(NULL)
+ : ptr(nullptr)
, owned(true)
{
new(str) std::string(s);
}
Param(int, const std::string& s)
- : ptr(NULL)
+ : ptr(nullptr)
, owned(true)
{
new(str) std::string(s);
@@ -309,7 +309,7 @@ public:
* with SetCommand() before the message is serialized.
* @param Sourceuser See the one parameter constructor of MessageSource for description.
*/
- Message(const char* cmd, User* Sourceuser = NULL)
+ Message(const char* cmd, User* Sourceuser = nullptr)
: ClientProtocol::MessageSource(Sourceuser)
, command(cmd ? cmd : std::string())
{
@@ -324,7 +324,7 @@ public:
* Must remain valid as long as this object is alive.
* @param Sourceuser See the two parameter constructor of MessageSource for description.
*/
- Message(const char* cmd, const std::string& Sourcestr, User* Sourceuser = NULL)
+ Message(const char* cmd, const std::string& Sourcestr, User* Sourceuser = nullptr)
: ClientProtocol::MessageSource(Sourcestr, Sourceuser)
, command(cmd ? cmd : std::string())
{
@@ -403,7 +403,7 @@ public:
* @param val Tag value. If empty no value will be sent with the tag.
* @param tagdata Tag provider specific data, will be passed to MessageTagProvider::ShouldSendTag(). Optional, defaults to NULL.
*/
- void AddTag(const std::string& tagname, MessageTagProvider* tagprov, const std::string& val, void* tagdata = NULL)
+ void AddTag(const std::string& tagname, MessageTagProvider* tagprov, const std::string& val, void* tagdata = nullptr)
{
tags.emplace(tagname, MessageTagData(tagprov, val, tagdata));
}
@@ -499,7 +499,7 @@ public:
void SetMessage(Message* msg)
{
initialmsg = msg;
- initialmsglist = NULL;
+ initialmsglist = nullptr;
}
/** Set a list of messages as the initial messages in the event.
@@ -507,7 +507,7 @@ public:
*/
void SetMessageList(const MessageList& msglist)
{
- initialmsg = NULL;
+ initialmsg = nullptr;
initialmsglist = &msglist;
}
@@ -662,19 +662,19 @@ struct ClientProtocol::RFCEvents final
EventProvider error;
RFCEvents()
- : numeric(NULL, "NUMERIC")
- , join(NULL, "JOIN")
- , part(NULL, "PART")
- , kick(NULL, "KICK")
- , quit(NULL, "QUIT")
- , nick(NULL, "NICK")
- , mode(NULL, "MODE")
- , topic(NULL, "TOPIC")
- , privmsg(NULL, "PRIVMSG")
- , invite(NULL, "INVITE")
- , ping(NULL, "PING")
- , pong(NULL, "PONG")
- , error(NULL, "ERROR")
+ : numeric(nullptr, "NUMERIC")
+ , join(nullptr, "JOIN")
+ , part(nullptr, "PART")
+ , kick(nullptr, "KICK")
+ , quit(nullptr, "QUIT")
+ , nick(nullptr, "NICK")
+ , mode(nullptr, "MODE")
+ , topic(nullptr, "TOPIC")
+ , privmsg(nullptr, "PRIVMSG")
+ , invite(nullptr, "INVITE")
+ , ping(nullptr, "PING")
+ , pong(nullptr, "PONG")
+ , error(nullptr, "ERROR")
{
}
};
diff --git a/include/clientprotocolmsg.h b/include/clientprotocolmsg.h
index c0a85a792..22a462b63 100644
--- a/include/clientprotocolmsg.h
+++ b/include/clientprotocolmsg.h
@@ -69,7 +69,7 @@ public:
* @param user User to send the numeric to. May be unregistered, must remain valid as long as this object is alive.
*/
Numeric(const ::Numeric::Numeric& num, User* user)
- : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetPublicName())
+ : ClientProtocol::Message(nullptr, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetPublicName())
{
if (user->registered & REG_NICK)
PushParamRef(user->nick);
@@ -83,7 +83,7 @@ public:
* @param target Target string, must stay valid as long as this object is alive.
*/
Numeric(const ::Numeric::Numeric& num, const std::string& target)
- : ClientProtocol::Message(NULL, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetPublicName())
+ : ClientProtocol::Message(nullptr, (num.GetServer() ? num.GetServer() : ServerInstance->FakeClient->server)->GetPublicName())
{
PushParamRef(target);
InitFromNumeric(num);
@@ -93,7 +93,7 @@ public:
* @param num Numeric number.
*/
Numeric(unsigned int num)
- : ClientProtocol::Message(NULL, ServerInstance->Config->GetServerName())
+ : ClientProtocol::Message(nullptr, ServerInstance->Config->GetServerName())
{
InitCommand(num);
PushParam("*");
@@ -113,7 +113,7 @@ public:
*/
Join()
: ClientProtocol::Message("JOIN")
- , memb(NULL)
+ , memb(nullptr)
{
}
@@ -342,8 +342,8 @@ public:
*/
Mode()
: ClientProtocol::Message("MODE", ServerInstance->FakeClient)
- , chantarget(NULL)
- , usertarget(NULL)
+ , chantarget(nullptr)
+ , usertarget(nullptr)
{
}
diff --git a/include/command_parse.h b/include/command_parse.h
index 5e6806a85..a73573a11 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -59,7 +59,7 @@ public:
* command simply did not exist at all or the wrong number of parameters were given, or the user
* was not privileged enough to execute the command.
*/
- CmdResult CallHandler(const std::string& commandname, const CommandBase::Params& parameters, User* user, Command** cmd = NULL);
+ CmdResult CallHandler(const std::string& commandname, const CommandBase::Params& parameters, User* user, Command** cmd = nullptr);
/** Get the handler function for a command.
* @param commandname The command required. Always use uppercase for this parameter.
@@ -136,7 +136,7 @@ public:
* @param custom_translator Used to translate the parameter if the translation type is TR_CUSTOM, if NULL, TR_CUSTOM will act like TR_TEXT
* @param paramnumber The index of the parameter we are translating.
*/
- static void TranslateSingleParam(TranslateType to, const std::string& item, std::string& dest, CommandBase* custom_translator = NULL, unsigned int paramnumber = 0);
+ static void TranslateSingleParam(TranslateType to, const std::string& item, std::string& dest, CommandBase* custom_translator = nullptr, unsigned int paramnumber = 0);
/** Translate nicknames in a list of strings into UIDs, based on the TranslateTypes given.
* @param to The translation types to use for the process. If this list is too short, TR_TEXT is assumed for the rest.
@@ -145,5 +145,5 @@ public:
* @param custom_translator Used to translate the parameter if the translation type is TR_CUSTOM, if NULL, TR_CUSTOM will act like TR_TEXT
* @return dest The output string
*/
- static std::string TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final = false, CommandBase* custom_translator = NULL);
+ static std::string TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final = false, CommandBase* custom_translator = nullptr);
};
diff --git a/include/configreader.h b/include/configreader.h
index 8660644e7..998249292 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -593,7 +593,7 @@ public:
* @param user The user who initiated the config load or NULL if not initiated by a user.
* @param isinitial Whether this is the initial config load.
*/
- ConfigStatus(User* user = NULL, bool isinitial = false)
+ ConfigStatus(User* user = nullptr, bool isinitial = false)
: initial(isinitial)
, srcuser(user)
{
diff --git a/include/dynref.h b/include/dynref.h
index 512be86fd..f5a980611 100644
--- a/include/dynref.h
+++ b/include/dynref.h
@@ -55,7 +55,7 @@ public:
void SetCaptureHook(CaptureHook* h) { hook = h; }
void check();
- operator bool() const { return (value != NULL); }
+ operator bool() const { return (value != nullptr); }
static void reset_all();
};
diff --git a/include/inspircd.h b/include/inspircd.h
index 7cdad2e31..7883d9db6 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -399,8 +399,8 @@ public:
* @param mask The glob pattern to match against.
* @param map The character map to use when matching.
*/
- static bool Match(const std::string& str, const std::string& mask, const unsigned char* map = NULL);
- static bool Match(const char* str, const char* mask, const unsigned char* map = NULL);
+ static bool Match(const std::string& str, const std::string& mask, const unsigned char* map = nullptr);
+ static bool Match(const char* str, const char* mask, const unsigned char* map = nullptr);
/** Match two strings using pattern matching, optionally, with a map
* to check case against (may be NULL). If map is null, match will be case insensitive.
@@ -409,8 +409,8 @@ public:
* @param mask The glob or CIDR pattern to match against.
* @param map The character map to use when matching.
*/
- static bool MatchCIDR(const std::string& str, const std::string& mask, const unsigned char* map = NULL);
- static bool MatchCIDR(const char* str, const char* mask, const unsigned char* map = NULL);
+ static bool MatchCIDR(const std::string& str, const std::string& mask, const unsigned char* map = nullptr);
+ static bool MatchCIDR(const char* str, const char* mask, const unsigned char* map = nullptr);
/** Matches a hostname and IP against a space delimited list of hostmasks.
* @param masks The space delimited masks to match against.
@@ -504,7 +504,7 @@ public:
* @param utc True to convert the time to string as-is, false to convert it to local time first.
* @return A string representing the given date/time.
*/
- static std::string TimeString(time_t curtime, const char* format = NULL, bool utc = false);
+ static std::string TimeString(time_t curtime, const char* format = nullptr, bool utc = false);
/** Compare two strings in a timing-safe way. If the lengths of the strings differ, the function
* returns false immediately (leaking information about the length), otherwise it compares each
diff --git a/include/inspsocket.h b/include/inspsocket.h
index e950b49ff..12fe710f0 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -437,4 +437,4 @@ protected:
};
inline IOHook* StreamSocket::GetIOHook() const { return iohook; }
-inline void StreamSocket::DelIOHook() { iohook = NULL; }
+inline void StreamSocket::DelIOHook() { iohook = nullptr; }
diff --git a/include/intrusive_list.h b/include/intrusive_list.h
index aeb57abeb..c0d4bd2bc 100644
--- a/include/intrusive_list.h
+++ b/include/intrusive_list.h
@@ -41,7 +41,7 @@ class intrusive_list_node
ptr_next->intrusive_list_node<T, Tag>::ptr_prev = this->ptr_prev;
if (ptr_prev)
ptr_prev->intrusive_list_node<T, Tag>::ptr_next = this->ptr_next;
- ptr_next = ptr_prev = NULL;
+ ptr_next = ptr_prev = nullptr;
}
public:
diff --git a/include/intrusive_list_impl.h b/include/intrusive_list_impl.h
index cdfe1cb81..9b492747b 100644
--- a/include/intrusive_list_impl.h
+++ b/include/intrusive_list_impl.h
@@ -29,7 +29,7 @@ public:
T* curr;
public:
- iterator(T* i = NULL)
+ iterator(T* i = nullptr)
: curr(i)
{
}
diff --git a/include/iohook.h b/include/iohook.h
index 5abd0b043..a5f6f5819 100644
--- a/include/iohook.h
+++ b/include/iohook.h
@@ -168,7 +168,7 @@ public:
{
if (hook->prov->IsMiddle())
return static_cast<IOHookMiddle*>(hook);
- return NULL;
+ return nullptr;
}
friend class StreamSocket;
diff --git a/include/listmode.h b/include/listmode.h
index de52a974b..07e66a37e 100644
--- a/include/listmode.h
+++ b/include/listmode.h
@@ -190,7 +190,7 @@ inline ListModeBase::ModeList* ListModeBase::GetList(Channel* channel)
{
ChanData* cd = extItem.Get(channel);
if (!cd)
- return NULL;
+ return nullptr;
return &cd->list;
}
diff --git a/include/mode.h b/include/mode.h
index 1603892cf..d7d4dd2e9 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -820,30 +820,30 @@ public:
inline PrefixMode* ModeHandler::IsPrefixMode()
{
- return (this->type_id == MC_PREFIX ? static_cast<PrefixMode*>(this) : NULL);
+ return (this->type_id == MC_PREFIX ? static_cast<PrefixMode*>(this) : nullptr);
}
inline const PrefixMode* ModeHandler::IsPrefixMode() const
{
- return (this->type_id == MC_PREFIX ? static_cast<const PrefixMode*>(this) : NULL);
+ return (this->type_id == MC_PREFIX ? static_cast<const PrefixMode*>(this) : nullptr);
}
inline ListModeBase* ModeHandler::IsListModeBase()
{
- return (this->type_id == MC_LIST ? reinterpret_cast<ListModeBase*>(this) : NULL);
+ return (this->type_id == MC_LIST ? reinterpret_cast<ListModeBase*>(this) : nullptr);
}
inline const ListModeBase* ModeHandler::IsListModeBase() const
{
- return (this->type_id == MC_LIST ? reinterpret_cast<const ListModeBase*>(this) : NULL);
+ return (this->type_id == MC_LIST ? reinterpret_cast<const ListModeBase*>(this) : nullptr);
}
inline ParamModeBase* ModeHandler::IsParameterMode()
{
- return (this->type_id == MC_PARAM ? reinterpret_cast<ParamModeBase*>(this) : NULL);
+ return (this->type_id == MC_PARAM ? reinterpret_cast<ParamModeBase*>(this) : nullptr);
}
inline const ParamModeBase* ModeHandler::IsParameterMode() const
{
- return (this->type_id == MC_PARAM ? reinterpret_cast<const ParamModeBase*>(this) : NULL);
+ return (this->type_id == MC_PARAM ? reinterpret_cast<const ParamModeBase*>(this) : nullptr);
}
diff --git a/include/modules.h b/include/modules.h
index dba5add5a..a2eecf74d 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1098,7 +1098,7 @@ public:
* then this contains a the module that your module must be placed before
* or after.
*/
- bool SetPriority(Module* mod, Implementation i, Priority s, Module* which = NULL);
+ bool SetPriority(Module* mod, Implementation i, Priority s, Module* which = nullptr);
/** Change the priority of all events in a module.
* @param mod The module to set the priority of
diff --git a/include/modules/cap.h b/include/modules/cap.h
index 77145acd6..77434642a 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -143,7 +143,7 @@ namespace Cap
void Unregister()
{
bit = 0;
- extitem = NULL;
+ extitem = nullptr;
}
Ext AddToMask(Ext mask) const { return (mask | GetMask()); }
@@ -243,7 +243,7 @@ namespace Cap
* The cap must be active and the manager must be available for a cap to be registered.
* @return True if the cap is registered in the manager, false otherwise
*/
- bool IsRegistered() const { return (extitem != NULL); }
+ bool IsRegistered() const { return (extitem != nullptr); }
/** Get the CAP negotiation protocol version of a user.
* The cap must be registered for this to return anything other than CAP_LEGACY.
@@ -281,7 +281,7 @@ namespace Cap
*/
virtual const std::string* GetValue(LocalUser* user) const
{
- return NULL;
+ return nullptr;
}
};
@@ -304,7 +304,7 @@ namespace Cap
/** Retrieves the underlying cap. */
operator const Cap::Capability*() const
{
- return ref ? *ref : NULL;
+ return ref ? *ref : nullptr;
}
/** Check whether a user has the referenced capability turned on.
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 0c41a67ff..c8669fff0 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -161,7 +161,7 @@ namespace DNS
return &rr;
}
- return NULL;
+ return nullptr;
}
};
diff --git a/include/modules/invite.h b/include/modules/invite.h
index 466da4153..e5ff55a86 100644
--- a/include/modules/invite.h
+++ b/include/modules/invite.h
@@ -83,7 +83,7 @@ public:
* @param chan Channel to check
* @return True if the user is invited to the channel, false otherwise
*/
- bool IsInvited(LocalUser* user, Channel* chan) { return (Find(user, chan) != NULL); }
+ bool IsInvited(LocalUser* user, Channel* chan) { return (Find(user, chan) != nullptr); }
/** Removes an Invite if it exists
* @param user User whose invite to remove
@@ -122,7 +122,7 @@ public:
/** Check whether the invite will expire or not
* @return True if the invite is timed, false if it doesn't expire
*/
- bool IsTimed() const { return (expiretimer != NULL); }
+ bool IsTimed() const { return (expiretimer != nullptr); }
/** Serialize this object
* @param human Whether to serialize for human consumption or not.
diff --git a/include/modules/ircv3_batch.h b/include/modules/ircv3_batch.h
index 3640a4dea..804127bb9 100644
--- a/include/modules/ircv3_batch.h
+++ b/include/modules/ircv3_batch.h
@@ -147,7 +147,7 @@ public:
* Batches can be started with Manager::Start() and stopped with Manager::End().
* @return True if the batch is running, false otherwise.
*/
- bool IsRunning() const { return (manager != NULL); }
+ bool IsRunning() const { return (manager != nullptr); }
/** Get the batch start client protocol message.
* The returned message object can be manipulated to add extra parameters or labels to the message. The first
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 3e7ba18cc..b77294a58 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -206,7 +206,7 @@ public:
if (lasthook && (lasthook->prov->type == IOHookProvider::IOH_SSL))
return static_cast<SSLIOHook*>(lasthook);
- return NULL;
+ return nullptr;
}
SSLIOHook(std::shared_ptr<IOHookProvider> hookprov)
@@ -267,7 +267,7 @@ public:
{
SSLIOHook* ssliohook = SSLIOHook::IsSSL(sock);
if (!ssliohook)
- return NULL;
+ return nullptr;
return ssliohook->GetCertificate();
}
diff --git a/include/protocol.h b/include/protocol.h
index cf6099a07..a1b597992 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -66,7 +66,7 @@ public:
* and the message was sent, false if it was not found.
* ENCAP (should) be used instead of creating new protocol messages for easier third party application support.
*/
- virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source = NULL) { return false; }
+ virtual bool SendEncapsulatedData(const std::string& targetmask, const std::string& cmd, const CommandBase::Params& params, User* source = nullptr) { return false; }
/** Send an ENCAP message to all servers.
* See the protocol documentation for the purpose of ENCAP.
@@ -76,7 +76,7 @@ public:
* or NULL which is equivalent to the local server
* @param omit If non-NULL the message won't be sent in the direction of this server, useful for forwarding messages
*/
- virtual void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source = NULL, User* omit = NULL) { }
+ virtual void BroadcastEncap(const std::string& cmd, const CommandBase::Params& params, User* source = nullptr, User* omit = nullptr) { }
/** Send metadata for an extensible to other linked servers.
* @param ext The extensible to send metadata for
diff --git a/include/socket.h b/include/socket.h
index 33742c6f4..ba8ef828a 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -169,7 +169,7 @@ public:
{
public:
IOHookProvRef()
- : dynamic_reference_nocheck<IOHookProvider>(NULL, std::string())
+ : dynamic_reference_nocheck<IOHookProvider>(nullptr, std::string())
{
}
};
diff --git a/include/stdalgo.h b/include/stdalgo.h
index f9fe03a62..e22c03326 100644
--- a/include/stdalgo.h
+++ b/include/stdalgo.h
@@ -177,7 +177,7 @@ namespace stdalgo
void delete_zero(T*& pr)
{
T* p = pr;
- pr = NULL;
+ pr = nullptr;
delete p;
}
diff --git a/include/typedefs.h b/include/typedefs.h
index 5676bfe90..8cac70d5d 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -70,7 +70,7 @@ namespace ClientProtocol
std::string value;
void* provdata;
- MessageTagData(MessageTagProvider* prov, const std::string& val, void* data = NULL);
+ MessageTagData(MessageTagProvider* prov, const std::string& val, void* data = nullptr);
};
/** Map of message tag values and providers keyed by their name.
diff --git a/include/usermanager.h b/include/usermanager.h
index bdfdbe40e..be3dca18e 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -123,7 +123,7 @@ public:
* @param quitreason The quit reason to show to normal users
* @param operreason The quit reason to show to opers, can be NULL if same as quitreason
*/
- void QuitUser(User* user, const std::string& quitreason, const std::string* operreason = NULL);
+ void QuitUser(User* user, const std::string& quitreason, const std::string* operreason = nullptr);
/** Add a user to the clone map
* @param user The user to add
diff --git a/src/bancache.cpp b/src/bancache.cpp
index db11840ef..a79c94544 100644
--- a/src/bancache.cpp
+++ b/src/bancache.cpp
@@ -34,8 +34,8 @@ BanCacheHit::BanCacheHit(const std::string& type, const std::string& reason, tim
BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds)
{
BanCacheHit*& b = BanHash[ip];
- if (b != NULL) // can't have two cache entries on the same IP, sorry..
- return NULL;
+ if (b != nullptr) // can't have two cache entries on the same IP, sorry..
+ return nullptr;
b = new BanCacheHit(type, reason, (seconds ? seconds : 86400));
return b;
@@ -46,10 +46,10 @@ BanCacheHit *BanCacheManager::GetHit(const std::string &ip)
BanCacheHash::iterator i = this->BanHash.find(ip);
if (i == this->BanHash.end())
- return NULL; // free and safe
+ return nullptr; // free and safe
if (RemoveIfExpired(i))
- return NULL; // expired
+ return nullptr; // expired
return i->second; // hit.
}
diff --git a/src/base.cpp b/src/base.cpp
index 1c1d34364..21b260fe4 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -27,7 +27,7 @@
#include "base.h"
// This trick detects heap allocations of refcountbase objects
-static void* last_heap = NULL;
+static void* last_heap = nullptr;
void* refcountbase::operator new(size_t size)
{
@@ -38,7 +38,7 @@ void* refcountbase::operator new(size_t size)
void refcountbase::operator delete(void* obj)
{
if (last_heap == obj)
- last_heap = NULL;
+ last_heap = nullptr;
::operator delete(obj);
}
diff --git a/src/channels.cpp b/src/channels.cpp
index 5be9a0549..85925a2e8 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -37,7 +37,7 @@ enum
namespace
{
- ChanModeReference ban(NULL, "ban");
+ ChanModeReference ban(nullptr, "ban");
}
Channel::Channel(const std::string &cname, time_t ts)
@@ -78,7 +78,7 @@ Membership* Channel::AddUser(User* user)
{
std::pair<MemberMap::iterator, bool> ret = userlist.emplace(user, insp::aligned_storage<Membership>());
if (!ret.second)
- return NULL;
+ return nullptr;
Membership* memb = new(ret.first->second) Membership(user, this);
return memb;
@@ -126,7 +126,7 @@ Membership* Channel::GetUser(User* user)
{
MemberMap::iterator i = userlist.find(user);
if (i == userlist.end())
- return NULL;
+ return nullptr;
return i->second;
}
@@ -175,7 +175,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
if (user->registered != REG_ALL)
{
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join unregistered user " + user->uuid + " to channel " + cname);
- return NULL;
+ return nullptr;
}
/*
@@ -196,7 +196,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
if (user->chans.size() >= maxchans)
{
user->WriteNumeric(ERR_TOOMANYCHANNELS, cname, "You are on too many channels");
- return NULL;
+ return nullptr;
}
}
@@ -214,7 +214,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
// Ask the modules whether they're ok with the join, pass NULL as Channel* as the channel is yet to be created
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key, override));
+ FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, nullptr, cname, privs, key, override));
if (!override && MOD_RESULT == MOD_RES_DENY)
return nullptr; // A module wasn't happy with the join, abort
@@ -248,12 +248,12 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti
if (IS_SERVER(user))
{
ServerInstance->Logs.Debug("CHANNELS", "Attempted to join server user " + user->uuid + " to channel " + this->name);
- return NULL;
+ return nullptr;
}
Membership* memb = this->AddUser(user);
if (!memb)
- return NULL; // Already on the channel
+ return nullptr; // Already on the channel
user->chans.push_front(memb);
@@ -268,7 +268,7 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti
{
// Set the mode on the user.
Modes::Change modechange(mh, true, user->nick);
- mh->OnModeChange(ServerInstance->FakeClient, NULL, this, modechange);
+ mh->OnModeChange(ServerInstance->FakeClient, nullptr, this, modechange);
}
}
}
@@ -321,12 +321,12 @@ bool Channel::CheckBan(User* user, const std::string& mask)
const std::string nickIdent = user->nick + "!" + user->ident;
std::string prefix(mask, 0, at);
- if (InspIRCd::Match(nickIdent, prefix, NULL))
+ if (InspIRCd::Match(nickIdent, prefix, nullptr))
{
std::string suffix(mask, at + 1);
- if (InspIRCd::Match(user->GetRealHost(), suffix, NULL) ||
- InspIRCd::Match(user->GetDisplayedHost(), suffix, NULL) ||
- InspIRCd::MatchCIDR(user->GetIPString(), suffix, NULL))
+ if (InspIRCd::Match(user->GetRealHost(), suffix, nullptr) ||
+ InspIRCd::Match(user->GetDisplayedHost(), suffix, nullptr) ||
+ InspIRCd::MatchCIDR(user->GetIPString(), suffix, nullptr))
return true;
}
return false;
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index c74556ad3..afd071883 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -116,7 +116,7 @@ Command* CommandParser::GetHandler(const std::string &commandname)
if (n != cmdlist.end())
return n->second;
- return NULL;
+ return nullptr;
}
// calls a handler function for a command
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 76ddc6378..fa349fbe6 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -280,7 +280,7 @@ struct Parser final
stack.output.emplace(name, tag);
}
// this is not a leak; shared_ptr takes care of the delete
- tag = NULL;
+ tag = nullptr;
}
bool outer_parse()
@@ -647,7 +647,7 @@ long ConfigTag::getInt(const std::string& key, long def, long min, long max) con
return def;
const char* res_cstr = result.c_str();
- char* res_tail = NULL;
+ char* res_tail = nullptr;
long res = strtol(res_cstr, &res_tail, 0);
if (res_tail == res_cstr)
return def;
@@ -664,7 +664,7 @@ unsigned long ConfigTag::getUInt(const std::string& key, unsigned long def, unsi
return def;
const char* res_cstr = result.c_str();
- char* res_tail = NULL;
+ char* res_tail = nullptr;
unsigned long res = strtoul(res_cstr, &res_tail, 0);
if (res_tail == res_cstr)
return def;
@@ -697,7 +697,7 @@ double ConfigTag::getFloat(const std::string& key, double def, double min, doubl
if (!readString(key, result))
return def;
- double res = strtod(result.c_str(), NULL);
+ double res = strtod(result.c_str(), nullptr);
CheckRange(this, key, res, def, min, max);
return res;
}
diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp
index 80e55cfed..bcce17cbd 100644
--- a/src/coremods/core_channel/cmd_kick.cpp
+++ b/src/coremods/core_channel/cmd_kick.cpp
@@ -67,7 +67,7 @@ CmdResult CommandKick::Handle(User* user, const Params& parameters)
return CmdResult::FAILURE;
}
- Membership* srcmemb = NULL;
+ Membership* srcmemb = nullptr;
if (IS_LOCAL(user))
{
srcmemb = c->GetUser(user);
diff --git a/src/coremods/core_channel/cmode_k.cpp b/src/coremods/core_channel/cmode_k.cpp
index 437a4bf50..94de75982 100644
--- a/src/coremods/core_channel/cmode_k.cpp
+++ b/src/coremods/core_channel/cmode_k.cpp
@@ -42,7 +42,7 @@ ModeChannelKey::ModeChannelKey(Module* Creator)
ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, Modes::Change& change)
{
const std::string* key = ext.Get(channel);
- bool exists = (key != NULL);
+ bool exists = (key != nullptr);
if (IS_LOCAL(source))
{
if (exists == change.adding)
diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp
index 8d461a76c..a3f19c7de 100644
--- a/src/coremods/core_channel/core_channel.cpp
+++ b/src/coremods/core_channel/core_channel.cpp
@@ -72,14 +72,14 @@ public:
if (modechangelist.empty())
{
// Member got no modes on join
- joininguser = NULL;
+ joininguser = nullptr;
return;
}
joininguser = memb.user;
// Prepare a mode protocol event that we can append to the message list in OnPreEventSend()
- modemsg.SetParams(memb.chan, NULL, modechangelist);
+ modemsg.SetParams(memb.chan, nullptr, modechangelist);
if (modefromuser)
modemsg.SetSource(join);
else
@@ -355,7 +355,7 @@ public:
if (!ExtBan::Parse(mask, name, value, inverted))
return MOD_RES_PASSTHRU;
- ExtBan::Base* extban = NULL;
+ ExtBan::Base* extban = nullptr;
if (name.size() == 1)
extban = extbanmgr.FindLetter(name[0]);
else
diff --git a/src/coremods/core_channel/invite.cpp b/src/coremods/core_channel/invite.cpp
index 9372a924e..c44cff58c 100644
--- a/src/coremods/core_channel/invite.cpp
+++ b/src/coremods/core_channel/invite.cpp
@@ -112,7 +112,7 @@ void Invite::APIImpl::Create(LocalUser* user, Channel* chan, time_t timeout)
{
// Convert timed invite to non-expiring
delete inv->expiretimer;
- inv->expiretimer = NULL;
+ inv->expiretimer = nullptr;
}
else if (inv->expiretimer->GetTrigger() >= ServerInstance->Time() + timeout)
{
@@ -140,7 +140,7 @@ Invite::Invite* Invite::APIImpl::Find(LocalUser* user, Channel* chan)
{
const List* list = APIImpl::GetList(user);
if (!list)
- return NULL;
+ return nullptr;
for (auto* inv : *list)
{
@@ -148,7 +148,7 @@ Invite::Invite* Invite::APIImpl::Find(LocalUser* user, Channel* chan)
return inv;
}
- return NULL;
+ return nullptr;
}
const Invite::List* Invite::APIImpl::GetList(LocalUser* user)
@@ -156,7 +156,7 @@ const Invite::List* Invite::APIImpl::GetList(LocalUser* user)
Store<LocalUser>* list = userext.Get(user);
if (list)
return &list->invites;
- return NULL;
+ return nullptr;
}
void Invite::APIImpl::Unserialize(LocalUser* user, const std::string& value)
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index 900293d39..e61e745c1 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -460,7 +460,7 @@ public:
, Timer(5*60, true)
{
for (unsigned int i = 0; i <= MAX_REQUEST_ID; ++i)
- requests[i] = NULL;
+ requests[i] = nullptr;
ServerInstance->Timers.AddTimer(this);
}
@@ -575,7 +575,7 @@ public:
void RemoveRequest(DNS::Request* req) override
{
if (requests[req->id] == req)
- requests[req->id] = NULL;
+ requests[req->id] = nullptr;
}
std::string GetErrorStr(Error e) override
diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp
index 7a1e8154d..8d1c411dc 100644
--- a/src/coremods/core_message.cpp
+++ b/src/coremods/core_message.cpp
@@ -222,7 +222,7 @@ private:
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()));
if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
- target = NULL;
+ target = nullptr;
}
else
{
@@ -298,7 +298,7 @@ public:
// If the message begins with one or more status characters then look them up.
const char* target = parameters[0].c_str();
- PrefixMode* targetpfx = NULL;
+ PrefixMode* targetpfx = nullptr;
for (PrefixMode* pfx; (pfx = ServerInstance->Modes.FindPrefix(target[0])); ++target)
{
// We want the lowest ranked prefix specified.
@@ -361,7 +361,7 @@ public:
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()));
if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
- target = NULL;
+ target = nullptr;
}
else
{
diff --git a/src/coremods/core_mode.cpp b/src/coremods/core_mode.cpp
index 56c65b26a..048f2845d 100644
--- a/src/coremods/core_mode.cpp
+++ b/src/coremods/core_mode.cpp
@@ -101,7 +101,7 @@ CmdResult CommandMode::Handle(User* user, const Params& parameters)
{
const std::string& target = parameters[0];
Channel* targetchannel = ServerInstance->Channels.Find(target);
- User* targetuser = NULL;
+ User* targetuser = nullptr;
if (!targetchannel)
{
if (IS_LOCAL(user))
diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp
index 2a3f8467c..e1b061c89 100644
--- a/src/coremods/core_oper/cmd_kill.cpp
+++ b/src/coremods/core_oper/cmd_kill.cpp
@@ -44,7 +44,7 @@ class KillMessage final
{
public:
KillMessage(ClientProtocol::EventProvider& protoev, User* user, LocalUser* target, const std::string& text, const std::string& hidenick)
- : ClientProtocol::Message("KILL", NULL)
+ : ClientProtocol::Message("KILL", nullptr)
{
if (hidenick.empty())
SetSourceUser(user);
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp
index e9a5d5586..5e51a3b67 100644
--- a/src/coremods/core_reloadmodule.cpp
+++ b/src/coremods/core_reloadmodule.cpp
@@ -560,7 +560,7 @@ void DataKeeper::Restore(Module* newmod)
void DataKeeper::Fail()
{
- this->mod = NULL;
+ this->mod = nullptr;
ServerInstance->Logs.Debug(MODNAME, "Restore failed, notifying modules");
DoRestoreModules();
@@ -627,7 +627,7 @@ void DataKeeper::DoRestoreUsers()
continue;
RestoreObj(userdata, user, MODETYPE_USER, modechange);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, NULL, user, modechange, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, nullptr, user, modechange, ModeParser::MODE_LOCALONLY);
modechange.clear();
}
}
@@ -648,12 +648,12 @@ void DataKeeper::DoRestoreChans()
RestoreObj(chandata, chan, MODETYPE_CHANNEL, modechange);
// Process the mode change before applying any prefix modes
- ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, modechange, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, nullptr, modechange, ModeParser::MODE_LOCALONLY);
modechange.clear();
// Restore all member data
RestoreMemberData(chan, chandata.memberdatalist, modechange);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, modechange, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, nullptr, modechange, ModeParser::MODE_LOCALONLY);
modechange.clear();
}
}
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index b0f4a7456..0386abca8 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -439,7 +439,7 @@ void CommandWho::WhoUsers(LocalUser* source, const std::vector<std::string>& par
if (!MatchUser(source, user, data))
continue;
- SendWhoLine(source, parameters, NULL, user, data);
+ SendWhoLine(source, parameters, nullptr, user, data);
}
}
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index 0fbc65ff6..37c491e3d 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -237,7 +237,7 @@ const WhoWas::Nick* WhoWas::Manager::FindNick(const std::string& nickname) const
{
whowas_users::const_iterator it = whowas.find(nickname);
if (it == whowas.end())
- return NULL;
+ return nullptr;
return it->second;
}
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index a2eb5716d..aef99ff12 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -84,7 +84,7 @@ private:
XLine* xl = make->Generate(ServerInstance->Time(), 0, ServerInstance->Config->ServerName, reason, mask);
xl->from_config = true;
configlines.insert(xl->Displayable());
- if (!ServerInstance->XLines->AddLine(xl, NULL))
+ if (!ServerInstance->XLines->AddLine(xl, nullptr))
delete xl;
}
@@ -123,7 +123,7 @@ public:
if (user->quitting)
return;
- user->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ user->exempt = (ServerInstance->XLines->MatchesLine("E", user) != nullptr);
user->CheckLines(true);
}
@@ -133,7 +133,7 @@ public:
if (!luser || luser->quitting)
return;
- luser->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ luser->exempt = (ServerInstance->XLines->MatchesLine("E", user) != nullptr);
luser->CheckLines(false);
}
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 94f93d4f4..6f1e5dce6 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -68,13 +68,13 @@ DLLManager::~DLLManager()
Module* DLLManager::CallInit()
{
if (!lib)
- return NULL;
+ return nullptr;
const unsigned long* abi = GetSymbol<const unsigned long>(MODULE_STR_ABI);
if (!abi)
{
err.assign(libname + " is not a module (no ABI symbol)");
- return NULL;
+ return nullptr;
}
else if (*abi != MODULE_ABI)
{
@@ -82,7 +82,7 @@ Module* DLLManager::CallInit()
err.assign(InspIRCd::Format("%s was built against %s (%lu) which is too %s to use with %s (%lu).",
libname.c_str(), version ? version : "an unknown version", *abi,
*abi < MODULE_ABI ? "old" : "new", INSPIRCD_VERSION, MODULE_ABI));
- return NULL;
+ return nullptr;
}
union
@@ -95,7 +95,7 @@ Module* DLLManager::CallInit()
if (!vptr)
{
err.assign(libname + " is not a module (no init symbol)");
- return NULL;
+ return nullptr;
}
return (*fptr)();
@@ -104,7 +104,7 @@ Module* DLLManager::CallInit()
void* DLLManager::GetSymbol(const char* name) const
{
if (!lib)
- return NULL;
+ return nullptr;
#if defined _WIN32
return GetProcAddress(lib, name);
@@ -118,7 +118,7 @@ void DLLManager::RetrieveLastError()
#if defined _WIN32
char errmsg[500];
DWORD dwErrorCode = GetLastError();
- if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)errmsg, _countof(errmsg), NULL) == 0)
+ if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)errmsg, _countof(errmsg), nullptr) == 0)
sprintf_s(errmsg, _countof(errmsg), "Error code: %u", dwErrorCode);
SetLastError(ERROR_SUCCESS);
err = errmsg;
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ddad6cfc7..f7b08baab 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -62,7 +62,7 @@
# include <process.h>
#endif
-InspIRCd* ServerInstance = NULL;
+InspIRCd* ServerInstance = nullptr;
/** Separate from the other casemap tables so that code *can* still exclusively rely on RFC casemapping
* if it must.
@@ -154,7 +154,7 @@ namespace
if (!SetGroup.empty())
{
errno = 0;
- if (setgroups(0, NULL) == -1)
+ if (setgroups(0, nullptr) == -1)
{
ServerInstance->Logs.Normal("STARTUP", "setgroups() failed (wtf?): %s", strerror(errno));
InspIRCd::QuickExit(EXIT_STATUS_CONFIG);
@@ -199,7 +199,7 @@ namespace
{
#ifdef _WIN32
TCHAR configPath[MAX_PATH + 1];
- if (GetFullPathName(path, MAX_PATH, configPath, NULL) > 0)
+ if (GetFullPathName(path, MAX_PATH, configPath, nullptr) > 0)
return configPath;
#else
char configPath[PATH_MAX + 1];
@@ -523,7 +523,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
* a separate thread
*/
this->Config->Read();
- this->Config->Apply(NULL, "");
+ this->Config->Apply(nullptr, "");
try
{
@@ -636,11 +636,11 @@ void InspIRCd::UpdateTime()
SYSTEMTIME st;
GetSystemTime(&st);
- TIME.tv_sec = time(NULL);
+ TIME.tv_sec = time(nullptr);
TIME.tv_nsec = st.wMilliseconds;
#else
struct timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, nullptr);
TIME.tv_sec = tv.tv_sec;
TIME.tv_nsec = tv.tv_usec * 1000;
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 545e569e2..71fb493ec 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -37,18 +37,18 @@ static IOHook* GetNextHook(IOHook* hook)
IOHookMiddle* const iohm = IOHookMiddle::ToMiddleHook(hook);
if (iohm)
return iohm->GetNextHook();
- return NULL;
+ return nullptr;
}
BufferedSocket::BufferedSocket()
{
- Timeout = NULL;
+ Timeout = nullptr;
state = I_ERROR;
}
BufferedSocket::BufferedSocket(int newfd)
{
- Timeout = NULL;
+ Timeout = nullptr;
this->fd = newfd;
this->state = I_CONNECTED;
if (HasFd())
@@ -236,7 +236,7 @@ void StreamSocket::DoWrite()
while (hook)
{
ssize_t rv = hook->OnStreamSocketWrite(this, *psendq);
- psendq = NULL;
+ psendq = nullptr;
// rv == 0 means the socket has blocked. Stop trying to send data.
// IOHook has requested unblock notification from the socketengine.
@@ -250,7 +250,7 @@ void StreamSocket::DoWrite()
}
IOHookMiddle* const iohm = IOHookMiddle::ToMiddleHook(hook);
- hook = NULL;
+ hook = nullptr;
if (iohm)
{
psendq = &iohm->GetSendQ();
@@ -397,7 +397,7 @@ bool SocketTimeout::Tick()
ServerInstance->GlobalCulls.AddItem(sock);
}
- this->sock->Timeout = NULL;
+ this->sock->Timeout = nullptr;
delete this;
return false;
}
@@ -499,7 +499,7 @@ IOHook* StreamSocket::GetModHook(Module* mod) const
if (curr->prov->creator == mod)
return curr;
}
- return NULL;
+ return nullptr;
}
IOHook* StreamSocket::GetLastHook() const
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 6f7353e70..4d15b438e 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -93,7 +93,7 @@ ListenSocket::ListenSocket(std::shared_ptr<ConfigTag> tag, const irc::sockets::s
if (bind_to.family() == AF_UNIX)
{
const std::string permissionstr = tag->getString("permissions");
- unsigned long permissions = strtoul(permissionstr.c_str(), NULL, 8);
+ unsigned long permissions = strtoul(permissionstr.c_str(), nullptr, 8);
if (permissions && permissions <= 07777)
{
// This cast is safe thanks to the above check.
diff --git a/src/mode.cpp b/src/mode.cpp
index 9b06a7b8c..2b8e70f42 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -490,7 +490,7 @@ void ModeParser::ShowListModeList(User* user, Channel* chan, ModeHandler* mh)
{
if (mw->GetModeType() == MODETYPE_CHANNEL)
{
- if (!mw->BeforeMode(user, NULL, chan, modechange))
+ if (!mw->BeforeMode(user, nullptr, chan, modechange))
{
// A mode watcher doesn't want us to show the list
display = false;
@@ -667,7 +667,7 @@ bool ModeParser::DelMode(ModeHandler* mh)
Modes::ChangeList changelist;
mh->RemoveMode(chan, changelist);
- this->Process(ServerInstance->FakeClient, chan, NULL, changelist, MODE_LOCALONLY);
+ this->Process(ServerInstance->FakeClient, chan, nullptr, changelist, MODE_LOCALONLY);
}
}
break;
@@ -675,8 +675,8 @@ bool ModeParser::DelMode(ModeHandler* mh)
mhmap.erase(mhmapit);
if (mh->GetId() != MODEID_MAX)
- modehandlersbyid[mh->GetModeType()][mh->GetId()] = NULL;
- slot = NULL;
+ modehandlersbyid[mh->GetModeType()][mh->GetId()] = nullptr;
+ slot = nullptr;
if (mh->IsPrefixMode())
mhlist.prefix.erase(std::find(mhlist.prefix.begin(), mhlist.prefix.end(), mh->IsPrefixMode()));
else if (mh->IsListModeBase())
@@ -691,13 +691,13 @@ ModeHandler* ModeParser::FindMode(const std::string& modename, ModeType mt)
if (it != mhmap.end())
return it->second;
- return NULL;
+ return nullptr;
}
ModeHandler* ModeParser::FindMode(unsigned char modeletter, ModeType mt)
{
if (!ModeParser::IsModeChar(modeletter))
- return NULL;
+ return nullptr;
return modehandlers[mt][ModeParser::GetModeIndex(modeletter)];
}
@@ -706,7 +706,7 @@ PrefixMode* ModeParser::FindPrefixMode(unsigned char modeletter)
{
ModeHandler* mh = FindMode(modeletter, MODETYPE_CHANNEL);
if (!mh)
- return NULL;
+ return nullptr;
return mh->IsPrefixMode();
}
@@ -734,7 +734,7 @@ PrefixMode* ModeParser::FindPrefix(unsigned char pfxletter)
if (pm->GetPrefix() == pfxletter)
return pm;
}
- return NULL;
+ return nullptr;
}
void ModeParser::AddModeWatcher(ModeWatcher* mw)
@@ -764,7 +764,7 @@ void ModeHandler::RemoveMode(User* user)
{
Modes::ChangeList changelist;
changelist.push_remove(this);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, NULL, user, changelist, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, nullptr, user, changelist, ModeParser::MODE_LOCALONLY);
}
}
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index 516ce94f8..969a65d1e 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -60,7 +60,7 @@ bool ModuleManager::Load(const std::string& modname, bool defer)
return false;
}
- Module* newmod = NULL;
+ Module* newmod = nullptr;
DLLManager* newhandle = new DLLManager(moduleFile.c_str());
ServiceList newservices;
if (!defer)
@@ -69,7 +69,7 @@ bool ModuleManager::Load(const std::string& modname, bool defer)
try
{
newmod = newhandle->CallInit();
- this->NewServices = NULL;
+ this->NewServices = nullptr;
if (newmod)
{
@@ -105,7 +105,7 @@ bool ModuleManager::Load(const std::string& modname, bool defer)
}
catch (CoreException& modexcept)
{
- this->NewServices = NULL;
+ this->NewServices = nullptr;
// failure in module constructor
if (newmod)
diff --git a/src/modules.cpp b/src/modules.cpp
index ee2439fdc..dcba5bcb8 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -41,7 +41,7 @@
// Needs to be included after inspircd.h to avoid reincluding winsock.
#include <rang/rang.hpp>
-static insp::intrusive_list<dynamic_reference_base>* dynrefs = NULL;
+static insp::intrusive_list<dynamic_reference_base>* dynrefs = nullptr;
void dynamic_reference_base::reset_all()
{
@@ -548,8 +548,8 @@ void ModuleManager::LoadAll()
}
}
- this->NewServices = NULL;
- ConfigStatus confstatus(NULL, true);
+ this->NewServices = nullptr;
+ ConfigStatus confstatus(nullptr, true);
// Step 3: Read the configuration for the modules. This must be done as part of
// its own step so that services provided by modules can be registered before
@@ -648,7 +648,7 @@ ServiceProvider* ModuleManager::FindService(ServiceType type, const std::string&
DataProviderMap::iterator i = DataProviders.find(name);
if (i != DataProviders.end() && i->second->service == type)
return i->second;
- return NULL;
+ return nullptr;
}
// TODO implement finding of the other types
default:
@@ -695,7 +695,7 @@ dynamic_reference_base::~dynamic_reference_base()
if (dynrefs->empty())
{
delete dynrefs;
- dynrefs = NULL;
+ dynrefs = nullptr;
}
}
@@ -721,7 +721,7 @@ void dynamic_reference_base::resolve()
}
}
else
- value = NULL;
+ value = nullptr;
}
Module* ModuleManager::Find(const std::string &name)
@@ -729,7 +729,7 @@ Module* ModuleManager::Find(const std::string &name)
std::map<std::string, Module*>::const_iterator modfind = Modules.find(ExpandModName(name));
if (modfind == Modules.end())
- return NULL;
+ return nullptr;
else
return modfind->second;
}
diff --git a/src/modules/extra/m_argon2.cpp b/src/modules/extra/m_argon2.cpp
index 58e11eef0..d15fcf9bd 100644
--- a/src/modules/extra/m_argon2.cpp
+++ b/src/modules/extra/m_argon2.cpp
@@ -186,7 +186,7 @@ public:
void ReadConfig(ConfigStatus& status) override
{
- ProviderConfig defaultConfig("argon2", NULL);
+ ProviderConfig defaultConfig("argon2", nullptr);
argon2i.config = ProviderConfig("argon2i", &defaultConfig);
argon2d.config = ProviderConfig("argon2d", &defaultConfig);
argon2id.config = ProviderConfig("argon2id", &defaultConfig);
diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp
index 6a69d4a0e..80535c8d3 100644
--- a/src/modules/extra/m_geo_maxmind.cpp
+++ b/src/modules/extra/m_geo_maxmind.cpp
@@ -98,7 +98,7 @@ public:
// Attempt to locate this user.
location = GetLocation(user->client_sa);
if (!location)
- return NULL;
+ return nullptr;
// We found the user. Cache their location for future use.
ext.Set(user, location);
@@ -109,19 +109,19 @@ public:
{
// Skip trying to look up a UNIX socket.
if (sa.family() != AF_INET && sa.family() != AF_INET6)
- return NULL;
+ return nullptr;
// Attempt to look up the socket address.
int result;
MMDB_lookup_result_s lookup = MMDB_lookup_sockaddr(&mmdb, &sa.sa, &result);
if (result != MMDB_SUCCESS || !lookup.found_entry)
- return NULL;
+ return nullptr;
// Attempt to retrieve the country code.
MMDB_entry_data_s country_code;
- result = MMDB_get_value(&lookup.entry, &country_code, "country", "iso_code", NULL);
+ result = MMDB_get_value(&lookup.entry, &country_code, "country", "iso_code", nullptr);
if (result != MMDB_SUCCESS || !country_code.has_data || country_code.type != MMDB_DATA_TYPE_UTF8_STRING || country_code.data_size != 2)
- return NULL;
+ return nullptr;
// If the country has been seen before then use our cached Location object.
const std::string code(country_code.utf8_string, country_code.data_size);
@@ -131,9 +131,9 @@ public:
// Attempt to retrieve the country name.
MMDB_entry_data_s country_name;
- result = MMDB_get_value(&lookup.entry, &country_name, "country", "names", "en", NULL);
+ result = MMDB_get_value(&lookup.entry, &country_name, "country", "names", "en", nullptr);
if (result != MMDB_SUCCESS || !country_name.has_data || country_name.type != MMDB_DATA_TYPE_UTF8_STRING)
- return NULL;
+ return nullptr;
// Create a Location object and cache it.
const std::string cname(country_name.utf8_string, country_name.data_size);
diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp
index c1dfa40d9..ce327c3e8 100644
--- a/src/modules/extra/m_ldap.cpp
+++ b/src/modules/extra/m_ldap.cpp
@@ -79,7 +79,7 @@ public:
virtual ~LDAPRequest()
{
delete result;
- if (message != NULL)
+ if (message != nullptr)
ldap_msgfree(message);
}
@@ -244,14 +244,14 @@ public:
static void FreeMods(LDAPMod** mods)
{
- for (unsigned int i = 0; mods[i] != NULL; ++i)
+ for (unsigned int i = 0; mods[i] != nullptr; ++i)
{
LDAPMod* mod = mods[i];
- if (mod->mod_type != NULL)
+ if (mod->mod_type != nullptr)
free(mod->mod_type);
- if (mod->mod_values != NULL)
+ if (mod->mod_values != nullptr)
{
- for (unsigned int j = 0; mod->mod_values[j] != NULL; ++j)
+ for (unsigned int j = 0; mod->mod_values[j] != nullptr; ++j)
free(mod->mod_values[j]);
delete[] mod->mod_values;
}
@@ -267,7 +267,7 @@ private:
throw LDAPException("Unable to connect to LDAP service " + this->name + ": reconnecting too fast");
last_connect = ServerInstance->Time();
- ldap_unbind_ext(this->con, NULL, NULL);
+ ldap_unbind_ext(this->con, nullptr, nullptr);
Connect();
}
@@ -276,8 +276,8 @@ private:
int ret = ldap_set_option(this->con, option, value);
if (ret != LDAP_OPT_SUCCESS)
{
- ldap_unbind_ext(this->con, NULL, NULL);
- this->con = NULL;
+ ldap_unbind_ext(this->con, nullptr, nullptr);
+ this->con = nullptr;
}
return ret;
}
@@ -342,7 +342,7 @@ public:
this->UnlockQueue();
- ldap_unbind_ext(this->con, NULL, NULL);
+ ldap_unbind_ext(this->con, nullptr, nullptr);
}
void Connect()
@@ -433,14 +433,14 @@ private:
LDAPAttributes attributes;
char* dn = ldap_get_dn(this->con, cur);
- if (dn != NULL)
+ if (dn != nullptr)
{
attributes["dn"].push_back(dn);
ldap_memfree(dn);
- dn = NULL;
+ dn = nullptr;
}
- BerElement* ber = NULL;
+ BerElement* ber = nullptr;
for (char* attr = ldap_first_attribute(this->con, cur, &ber); attr; attr = ldap_next_attribute(this->con, cur, ber))
{
@@ -455,7 +455,7 @@ private:
ldap_value_free_len(vals);
ldap_memfree(attr);
}
- if (ber != NULL)
+ if (ber != nullptr)
ber_free(ber, 0);
ldap_result->messages.push_back(attributes);
@@ -656,7 +656,7 @@ int LDAPBind::run()
cred.bv_val = strdup(pass.c_str());
cred.bv_len = pass.length();
- int i = ldap_sasl_bind_s(service->GetConnection(), who.c_str(), LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
+ int i = ldap_sasl_bind_s(service->GetConnection(), who.c_str(), LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, nullptr);
free(cred.bv_val);
@@ -670,7 +670,7 @@ std::string LDAPBind::info()
int LDAPSearch::run()
{
- return ldap_search_ext_s(service->GetConnection(), base.c_str(), searchscope, filter.c_str(), NULL, 0, NULL, NULL, &tv, 0, &message);
+ return ldap_search_ext_s(service->GetConnection(), base.c_str(), searchscope, filter.c_str(), nullptr, 0, nullptr, nullptr, &tv, 0, &message);
}
std::string LDAPSearch::info()
@@ -681,7 +681,7 @@ std::string LDAPSearch::info()
int LDAPAdd::run()
{
LDAPMod** mods = LDAPService::BuildMods(attributes);
- int i = ldap_add_ext_s(service->GetConnection(), dn.c_str(), mods, NULL, NULL);
+ int i = ldap_add_ext_s(service->GetConnection(), dn.c_str(), mods, nullptr, nullptr);
LDAPService::FreeMods(mods);
return i;
}
@@ -693,7 +693,7 @@ std::string LDAPAdd::info()
int LDAPDel::run()
{
- return ldap_delete_ext_s(service->GetConnection(), dn.c_str(), NULL, NULL);
+ return ldap_delete_ext_s(service->GetConnection(), dn.c_str(), nullptr, nullptr);
}
std::string LDAPDel::info()
@@ -704,7 +704,7 @@ std::string LDAPDel::info()
int LDAPModify::run()
{
LDAPMod** mods = LDAPService::BuildMods(attributes);
- int i = ldap_modify_ext_s(service->GetConnection(), base.c_str(), mods, NULL, NULL);
+ int i = ldap_modify_ext_s(service->GetConnection(), base.c_str(), mods, nullptr, nullptr);
LDAPService::FreeMods(mods);
return i;
}
@@ -720,7 +720,7 @@ int LDAPCompare::run()
cred.bv_val = strdup(val.c_str());
cred.bv_len = val.length();
- int ret = ldap_compare_ext_s(service->GetConnection(), dn.c_str(), attr.c_str(), &cred, NULL, NULL);
+ int ret = ldap_compare_ext_s(service->GetConnection(), dn.c_str(), attr.c_str(), &cred, nullptr, nullptr);
free(cred.bv_val);
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index 9e1406578..ead27295e 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -327,7 +327,7 @@ public:
const std::string pass = config->getString("pass");
const std::string dbname = config->getString("name");
unsigned int port = static_cast<unsigned int>(config->getUInt("port", 3306, 1, 65535));
- if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, CLIENT_IGNORE_SIGPIPE))
+ if (!mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, nullptr, CLIENT_IGNORE_SIGPIPE))
{
ServerInstance->Logs.Normal(MODNAME, "Unable to connect to the %s MySQL server: %s",
GetId().c_str(), mysql_error(connection));
@@ -435,7 +435,7 @@ public:
void ModuleSQL::init()
{
- if (mysql_library_init(0, NULL, NULL))
+ if (mysql_library_init(0, nullptr, nullptr))
throw ModuleException(this, "Unable to initialise the MySQL library!");
Dispatcher = new DispatcherThread(this);
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 30d2690a6..f2e23d2e0 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -198,7 +198,7 @@ public:
SQLConn(Module* Creator, std::shared_ptr<ConfigTag> tag)
: SQL::Provider(Creator, tag->getString("id"))
, conf(tag)
- , qinprog(NULL, "")
+ , qinprog(nullptr, "")
{
if (!DoConnect())
DelayReconnect();
@@ -384,7 +384,7 @@ restart:
}
delete qinprog.c;
- qinprog = QueueItem(NULL, "");
+ qinprog = QueueItem(nullptr, "");
goto restart;
}
else
@@ -520,7 +520,7 @@ restart:
if(sql)
{
PQfinish(sql);
- sql = NULL;
+ sql = nullptr;
}
}
};
@@ -599,7 +599,7 @@ public:
{
conn->qinprog.c->OnError(err);
delete conn->qinprog.c;
- conn->qinprog.c = NULL;
+ conn->qinprog.c = nullptr;
}
std::deque<QueueItem>::iterator j = conn->queue.begin();
while (j != conn->queue.end())
@@ -620,7 +620,7 @@ public:
bool ReconnectTimer::Tick()
{
- mod->retimer = NULL;
+ mod->retimer = nullptr;
mod->ReadConf();
delete this;
return false;
diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp
index 377939867..819046e2b 100644
--- a/src/modules/extra/m_regex_posix.cpp
+++ b/src/modules/extra/m_regex_posix.cpp
@@ -47,7 +47,7 @@ public:
return;
// Retrieve the size of the error message and allocate a buffer.
- size_t errorsize = regerror(error, &regex, NULL, 0);
+ size_t errorsize = regerror(error, &regex, nullptr, 0);
std::vector<char> errormsg(errorsize);
// Retrieve the error message and free the buffer.
@@ -64,7 +64,7 @@ public:
bool IsMatch(const std::string& text) override
{
- return !regexec(&regex, text.c_str(), 0, NULL, 0);
+ return !regexec(&regex, text.c_str(), 0, nullptr, 0);
}
std::optional<Regex::MatchCollection> Matches(const std::string& text) override
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index a388d3797..797f54a51 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -106,11 +106,11 @@ public:
, config(tag)
{
std::string host = tag->getString("hostname");
- if (sqlite3_open_v2(host.c_str(), &conn, SQLITE_OPEN_READWRITE, 0) != SQLITE_OK)
+ if (sqlite3_open_v2(host.c_str(), &conn, SQLITE_OPEN_READWRITE, nullptr) != SQLITE_OK)
{
// Even in case of an error conn must be closed
sqlite3_close(conn);
- conn = NULL;
+ conn = nullptr;
ServerInstance->Logs.Normal(MODNAME, "WARNING: Could not open DB with id: " + tag->getString("id"));
}
}
@@ -128,7 +128,7 @@ public:
{
SQLite3Result res;
sqlite3_stmt *stmt;
- int err = sqlite3_prepare_v2(conn, q.c_str(), static_cast<int>(q.length()), &stmt, NULL);
+ int err = sqlite3_prepare_v2(conn, q.c_str(), static_cast<int>(q.length()), &stmt, nullptr);
if (err != SQLITE_OK)
{
SQL::Error error(SQL::QSEND_FAIL, sqlite3_errmsg(conn));
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 11ec78db0..b21ce982f 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -129,7 +129,7 @@ namespace GnuTLS
gnutls_hash_hd_t is_digest;
if (gnutls_hash_init(&is_digest, hash) < 0)
throw Exception("Unknown hash type " + hashname);
- gnutls_hash_deinit(is_digest, NULL);
+ gnutls_hash_deinit(is_digest, nullptr);
}
gnutls_digest_algorithm_t get() const { return hash; }
@@ -311,7 +311,7 @@ namespace GnuTLS
ret.append(token);
gnutls_priority_t test;
- if (gnutls_priority_init(&test, ret.c_str(), NULL) < 0)
+ if (gnutls_priority_init(&test, ret.c_str(), nullptr) < 0)
{
// The new token broke the priority string, revert to the previously working one
ServerInstance->Logs.Debug(MODNAME, "Priority string token not recognized: \"%s\"", token.c_str());
@@ -441,7 +441,7 @@ namespace GnuTLS
{
// Copy data from GnuTLS buffers to recvq
gnutls_datum_t datum;
- gnutls_packet_get(packet, &datum, NULL);
+ gnutls_packet_get(packet, &datum, nullptr);
recvq.append(reinterpret_cast<const char*>(datum.data), datum.size);
gnutls_packet_deinit(packet);
@@ -610,8 +610,8 @@ private:
gnutls_bye(this->sess, GNUTLS_SHUT_WR);
gnutls_deinit(this->sess);
}
- sess = NULL;
- certificate = NULL;
+ sess = nullptr;
+ certificate = nullptr;
status = STATUS_NONE;
}
@@ -1116,7 +1116,7 @@ public:
void init() override
{
- ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(NULL));
+ ServerInstance->Logs.Normal(MODNAME, "GnuTLS lib version %s module was compiled for " GNUTLS_VERSION, gnutls_check_version(nullptr));
ServerInstance->GenRandom = GnuTLS::GenRandom;
}
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index 67a5cac79..2b4b34bc5 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -106,7 +106,7 @@ namespace mbedTLS
public:
bool Seed(Entropy& entropy)
{
- return (mbedtls_ctr_drbg_seed(get(), mbedtls_entropy_func, entropy.get(), NULL, 0) == 0);
+ return (mbedtls_ctr_drbg_seed(get(), mbedtls_entropy_func, entropy.get(), nullptr, 0) == 0);
}
void SetupConf(mbedtls_ssl_config* conf)
@@ -136,10 +136,10 @@ namespace mbedTLS
{
#if MBEDTLS_VERSION_MAJOR >= 3
int ret = mbedtls_pk_parse_key(get(), reinterpret_cast<const unsigned char*>(keystr.c_str()),
- keystr.size() + 1, NULL, 0, mbedtls_ctr_drbg_random, 0);
+ keystr.size() + 1, nullptr, 0, mbedtls_ctr_drbg_random, 0);
#else
int ret = mbedtls_pk_parse_key(get(), reinterpret_cast<const unsigned char*>(keystr.c_str()),
- keystr.size() + 1, NULL, 0);
+ keystr.size() + 1, nullptr, 0);
#endif
ThrowOnError(ret, "Unable to import private key");
}
@@ -221,7 +221,7 @@ namespace mbedTLS
ThrowOnError(ret, "Unable to load certificates");
}
- bool empty() const { return (get()->raw.p != NULL); }
+ bool empty() const { return (get()->raw.p != nullptr); }
};
class X509CRL final
@@ -295,7 +295,7 @@ namespace mbedTLS
mbedtls_ssl_config_init(&conf);
#ifdef INSPIRCD_MBEDTLS_LIBRARY_DEBUG
mbedtls_debug_set_threshold(INT_MAX);
- mbedtls_ssl_conf_dbg(&conf, DebugLogFunc, NULL);
+ mbedtls_ssl_conf_dbg(&conf, DebugLogFunc, nullptr);
#endif
// TODO: check ret of mbedtls_ssl_config_defaults
@@ -555,7 +555,7 @@ private:
mbedtls_ssl_close_notify(&sess);
mbedtls_ssl_free(&sess);
- certificate = NULL;
+ certificate = nullptr;
status = STATUS_NONE;
}
@@ -709,7 +709,7 @@ public:
else
GetProfile().SetupClientSession(&sess);
- mbedtls_ssl_set_bio(&sess, reinterpret_cast<void*>(sock), Push, Pull, NULL);
+ mbedtls_ssl_set_bio(&sess, reinterpret_cast<void*>(sock), Push, Pull, nullptr);
sock->AddIOHook(this);
Handshake(sock);
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 002411fa8..a7ad33aa4 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -64,7 +64,7 @@ static Module* thismod;
char* get_error()
{
- return ERR_error_string(ERR_get_error(), NULL);
+ return ERR_error_string(ERR_get_error(), nullptr);
}
static int OnVerify(int preverify_ok, X509_STORE_CTX* ctx);
@@ -94,7 +94,7 @@ namespace OpenSSL
if (!dhpfile)
throw Exception("Couldn't open DH file " + filename);
- dh = PEM_read_bio_DHparams(dhpfile, NULL, NULL, NULL);
+ dh = PEM_read_bio_DHparams(dhpfile, nullptr, nullptr, nullptr);
BIO_free(dhpfile);
if (!dh)
@@ -140,7 +140,7 @@ namespace OpenSSL
mode |= SSL_MODE_RELEASE_BUFFERS;
#endif
SSL_CTX_set_mode(ctx, mode);
- SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, nullptr);
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
SSL_CTX_set_info_callback(ctx, StaticSSLInfoCallback);
}
@@ -200,7 +200,7 @@ namespace OpenSSL
bool SetCA(const std::string& filename)
{
ERR_clear_error();
- return SSL_CTX_load_verify_locations(ctx, filename.c_str(), 0);
+ return SSL_CTX_load_verify_locations(ctx, filename.c_str(), nullptr);
}
void SetCRL(const std::string& crlfile, const std::string& crlpath, const std::string& crlmode)
@@ -227,11 +227,11 @@ namespace OpenSSL
}
ERR_clear_error();
if (!X509_STORE_load_locations(store,
- crlfile.empty() ? NULL : crlfile.c_str(),
- crlpath.empty() ? NULL : crlpath.c_str()))
+ crlfile.empty() ? nullptr : crlfile.c_str(),
+ crlpath.empty() ? nullptr : crlpath.c_str()))
{
unsigned long err = ERR_get_error();
- throw ModuleException(thismod, "Unable to load CRL file '" + crlfile + "' or CRL path '" + crlpath + "': '" + (err ? ERR_error_string(err, NULL) : "unknown") + "'");
+ throw ModuleException(thismod, "Unable to load CRL file '" + crlfile + "' or CRL path '" + crlpath + "': '" + (err ? ERR_error_string(err, nullptr) : "unknown") + "'");
}
/* Set CRL mode */
@@ -562,8 +562,8 @@ private:
SSL_shutdown(sess);
SSL_free(sess);
}
- sess = NULL;
- certificate = NULL;
+ sess = nullptr;
+ certificate = nullptr;
status = STATUS_NONE;
}
@@ -978,7 +978,7 @@ public:
: Module(VF_VENDOR, "Allows TLS encrypted connections using the OpenSSL library.")
{
// Initialize OpenSSL
- OPENSSL_init_ssl(0, NULL);
+ OPENSSL_init_ssl(0, nullptr);
biomethods = OpenSSL::BIOMethod::alloc();
thismod = this;
@@ -995,7 +995,7 @@ public:
// Register application specific data
char exdatastr[] = "inspircd";
- exdataindex = SSL_get_ex_new_index(0, exdatastr, NULL, NULL, NULL);
+ exdataindex = SSL_get_ex_new_index(0, exdatastr, nullptr, nullptr, nullptr);
if (exdataindex < 0)
throw ModuleException(this, "Failed to register application specific data");
}
diff --git a/src/modules/extra/m_sslrehashsignal.cpp b/src/modules/extra/m_sslrehashsignal.cpp
index 41b90d6df..e8abe7a1d 100644
--- a/src/modules/extra/m_sslrehashsignal.cpp
+++ b/src/modules/extra/m_sslrehashsignal.cpp
@@ -57,7 +57,7 @@ public:
ServerInstance->Logs.Normal(MODNAME, feedbackmsg);
const std::string str = "tls";
- FOREACH_MOD(OnModuleRehash, (NULL, str));
+ FOREACH_MOD(OnModuleRehash, (nullptr, str));
signaled = 0;
}
};
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 70b302f6e..621fa4f04 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -181,7 +181,7 @@ public:
{
if (alias.UserCommand)
{
- if (DoAlias(user, NULL, alias, compare, original_line))
+ if (DoAlias(user, nullptr, alias, compare, original_line))
{
return MOD_RES_DENY;
}
diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp
index c7bd7039c..dca983b3e 100644
--- a/src/modules/m_autoop.cpp
+++ b/src/modules/m_autoop.cpp
@@ -48,7 +48,7 @@ public:
return ServerInstance->Modes.FindPrefixMode(mid[0]);
ModeHandler* mh = ServerInstance->Modes.FindMode(mid, MODETYPE_CHANNEL);
- return mh ? mh->IsPrefixMode() : NULL;
+ return mh ? mh->IsPrefixMode() : nullptr;
}
ModResult AccessCheck(User* source, Channel* channel, Modes::Change& change) override
@@ -117,7 +117,7 @@ public:
changelist.push_add(given, memb->user->nick);
}
}
- ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist);
}
}
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 1926bf464..02db49a89 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -282,7 +282,7 @@ public:
for (const auto& redirect : *redirects)
changelist.push_add(*banwatcher.banmode, redirect.banmask);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, changelist, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, nullptr, changelist, ModeParser::MODE_LOCALONLY);
}
}
}
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 60cfba367..cb51f458d 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -102,7 +102,7 @@ struct CallerIDExtInfo final
void* old = GetRaw(container);
if (old)
- this->Delete(NULL, old);
+ this->Delete(nullptr, old);
callerid_data* dat = new callerid_data;
SetRaw(container, dat);
@@ -164,7 +164,7 @@ class CommandAccept final
*/
typedef std::pair<User*, bool> ACCEPTAction;
- static ACCEPTAction GetTargetAndAction(std::string& tok, User* cmdfrom = NULL)
+ static ACCEPTAction GetTargetAndAction(std::string& tok, User* cmdfrom = nullptr)
{
bool remove = (tok[0] == '-');
if ((remove) || (tok[0] == '+'))
@@ -177,7 +177,7 @@ class CommandAccept final
target = ServerInstance->Users.FindNick(tok);
if ((!target) || (target->registered != REG_ALL) || (target->quitting))
- target = NULL;
+ target = nullptr;
return std::make_pair(target, !remove);
}
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index 06522b315..b4ba0d7ce 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -199,7 +199,7 @@ public:
CapMap::const_iterator it = caps.find(capname);
if (it != caps.end())
return it->second;
- return NULL;
+ return nullptr;
}
void NotifyValueChange(Capability* cap) override
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 36e0ade78..fe4176766 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -73,17 +73,17 @@ class ModuleChanFilter final
const ChanFilter::ListItem* Match(User* user, Channel* chan, const std::string& text)
{
if (!IS_LOCAL(user))
- return NULL; // We don't handle remote users.
+ return nullptr; // We don't handle remote users.
if (user->HasPrivPermission("channels/ignore-chanfilter"))
- return NULL; // The source is an exempt server operator.
+ return nullptr; // The source is an exempt server operator.
if (CheckExemption::Call(exemptionprov, user, chan, "filter") == MOD_RES_ALLOW)
- return NULL; // The source matches an exemptchanops entry.
+ return nullptr; // The source matches an exemptchanops entry.
ListModeBase::ModeList* list = cf.GetList(chan);
if (!list)
- return NULL;
+ return nullptr;
for (const auto& entry : *list)
{
@@ -91,7 +91,7 @@ class ModuleChanFilter final
return &entry;
}
- return NULL;
+ return nullptr;
}
public:
diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp
index 931af03b9..7e88ee38a 100644
--- a/src/modules/m_channames.cpp
+++ b/src/modules/m_channames.cpp
@@ -79,7 +79,7 @@ public:
{
removepermchan.clear();
removepermchan.push_remove(*permchannelmode);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, removepermchan);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, c, nullptr, removepermchan);
}
Channel::MemberMap& users = c->userlist;
diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp
index d3a646a3c..0718d8f0d 100644
--- a/src/modules/m_clearchan.cpp
+++ b/src/modules/m_clearchan.cpp
@@ -55,7 +55,7 @@ public:
std::transform(method.begin(), method.end(), method.begin(), ::toupper);
}
- XLineFactory* xlf = NULL;
+ XLineFactory* xlf = nullptr;
bool kick = (method == "KICK");
if ((!kick) && (method != "KILL"))
{
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 5271d5305..db7bd2e29 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -411,7 +411,7 @@ public:
Modes::ChangeList modechangelist;
modechangelist.push_remove(&cu);
- ClientProtocol::Events::Mode modeevent(ServerInstance->FakeClient, NULL, u, modechangelist);
+ ClientProtocol::Events::Mode modeevent(ServerInstance->FakeClient, nullptr, u, modechangelist);
luser->Send(modeevent);
}
cu.active = false;
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index e074c9cc7..645345a82 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -148,7 +148,7 @@ public:
{
// Create Z-line for set duration.
ZLine* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, mask.str());
- if (!ServerInstance->XLines->AddLine(zl, NULL))
+ if (!ServerInstance->XLines->AddLine(zl, nullptr))
{
delete zl;
return;
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 52da3b51f..a1babeccb 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -168,7 +168,7 @@ public:
// If there is no redirect chan, the user has enabled the antiredirect mode, or
// the target channel redirects elsewhere we just tell the user and deny the join.
- Channel* target = NULL;
+ Channel* target = nullptr;
if (badchan.redirect.empty() || user->IsModeSet(antiredirectmode)
|| ((target = ServerInstance->Channels.Find(badchan.redirect)) && target->IsModeSet(redirectmode)))
{
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp
index eaa768308..7ea17e4f1 100644
--- a/src/modules/m_exemptchanops.cpp
+++ b/src/modules/m_exemptchanops.cpp
@@ -48,7 +48,7 @@ public:
return ServerInstance->Modes.FindPrefixMode(pmode[0]);
ModeHandler* mh = ServerInstance->Modes.FindMode(pmode, MODETYPE_CHANNEL);
- return mh ? mh->IsPrefixMode() : NULL;
+ return mh ? mh->IsPrefixMode() : nullptr;
}
static bool ParseEntry(const std::string& entry, std::string& restriction, std::string& prefix)
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 544ef99d8..51c13c07a 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -470,7 +470,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar
user->nick.c_str(), sh->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(),
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(sh, NULL))
+ if (ServerInstance->XLines->AddLine(sh, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -484,7 +484,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar
user->nick.c_str(), gl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(),
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(gl,NULL))
+ if (ServerInstance->XLines->AddLine(gl, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -498,7 +498,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, const MessageTarget& msgtar
user->nick.c_str(), zl->Displayable().c_str(), InspIRCd::DurationString(f->duration).c_str(),
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
msgtarget.GetName().c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(zl,NULL))
+ if (ServerInstance->XLines->AddLine(zl, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -577,7 +577,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params&
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
command.c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(gl,NULL))
+ if (ServerInstance->XLines->AddLine(gl, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -593,7 +593,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params&
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
command.c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(zl,NULL))
+ if (ServerInstance->XLines->AddLine(zl, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -610,7 +610,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params&
InspIRCd::TimeString(ServerInstance->Time() + f->duration).c_str(),
command.c_str(), f->freeform.c_str(), f->reason.c_str()));
- if (ServerInstance->XLines->AddLine(sh, NULL))
+ if (ServerInstance->XLines->AddLine(sh, nullptr))
{
ServerInstance->XLines->ApplyLines();
}
@@ -649,7 +649,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status)
filterconf = ServerInstance->Config->Paths.PrependConfig(filterconf);
SetInterval(tag->getDuration("saveperiod", 5));
- factory = RegexEngine ? (RegexEngine.operator->()) : NULL;
+ factory = RegexEngine ? (RegexEngine.operator->()) : nullptr;
RegexEngine.SetEngine(newrxengine);
if (!RegexEngine)
@@ -776,7 +776,7 @@ const FilterResult* ModuleFilter::FilterMatch(User* user, const std::string &tex
if (filter.regex->IsMatch(filter.flag_strip_color ? stripped_text : text))
return &filter;
}
- return NULL;
+ return nullptr;
}
bool ModuleFilter::DeleteFilter(const std::string& freeform, std::string& reason)
diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp
index 15e827507..448caefc1 100644
--- a/src/modules/m_gateway.cpp
+++ b/src/modules/m_gateway.cpp
@@ -170,7 +170,7 @@ public:
static bool ParseIP(const std::string& in, irc::sockets::sockaddrs& out)
{
- const char* ident = NULL;
+ const char* ident = nullptr;
if (in.length() == 8)
{
// The ident is an IPv4 address encoded in hexadecimal with two characters
@@ -195,7 +195,7 @@ public:
// Try to convert the IP address to a string. If this fails then the user
// does not have an IPv4 address in their ident.
errno = 0;
- unsigned long address = strtoul(ident, NULL, 16);
+ unsigned long address = strtoul(ident, nullptr, 16);
if (errno)
return false;
diff --git a/src/modules/m_geoban.cpp b/src/modules/m_geoban.cpp
index ecd8fe8e0..caaf038f6 100644
--- a/src/modules/m_geoban.cpp
+++ b/src/modules/m_geoban.cpp
@@ -39,7 +39,7 @@ public:
bool IsMatch(User* user, Channel* channel, const std::string& text) override
{
- Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL;
+ Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr;
const std::string code = location ? location->GetCode() : "XX";
// Does this user match against the ban?
@@ -71,7 +71,7 @@ public:
if (!request.flags['G'])
return MOD_RES_PASSTHRU;
- Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL;
+ Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr;
const std::string code = location ? location->GetCode() : "XX";
return InspIRCd::Match(code, request.matchtext, ascii_case_insensitive_map) ? MOD_RES_ALLOW : MOD_RES_DENY;
}
@@ -81,7 +81,7 @@ public:
if (whois.GetTarget()->server->IsService())
return;
- Geolocation::Location* location = geoapi ? geoapi->GetLocation(whois.GetTarget()) : NULL;
+ Geolocation::Location* location = geoapi ? geoapi->GetLocation(whois.GetTarget()) : nullptr;
if (location)
whois.SendLine(RPL_WHOISCOUNTRY, location->GetCode(), "is connecting from " + location->GetName());
else
diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp
index 4a0e53830..f381c57c4 100644
--- a/src/modules/m_geoclass.cpp
+++ b/src/modules/m_geoclass.cpp
@@ -44,7 +44,7 @@ public:
// If we can't find the location of this user then we can't assign
// them to a location-specific connect class.
- Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL;
+ Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr;
const std::string code = location ? location->GetCode() : "XX";
irc::spacesepstream codes(country);
diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp
index dcb1d4afd..8d6127d35 100644
--- a/src/modules/m_hidemode.cpp
+++ b/src/modules/m_hidemode.cpp
@@ -85,7 +85,7 @@ class ModeHook final
Modes::ChangeList* FilterModeChangeList(const ClientProtocol::Events::Mode& mode, ModeHandler::Rank rank)
{
- Modes::ChangeList* modechangelist = NULL;
+ Modes::ChangeList* modechangelist = nullptr;
for (Modes::ChangeList::List::const_iterator i = mode.GetChangeList().getlist().begin(); i != mode.GetChangeList().getlist().end(); ++i)
{
const Modes::Change& curr = *i;
@@ -156,14 +156,14 @@ class ModeHook final
if (filteredchangelist->empty())
{
// This rank cannot see any mode changes in the original change list
- finalmsgplist = NULL;
+ finalmsgplist = nullptr;
}
else
{
// This rank can see some of the mode changes in the filtered mode change list.
// Create and store a new protocol message from it.
filteredmsgplists.emplace_back();
- ClientProtocol::Events::Mode::BuildMessages(mode.GetMessages().front().GetSourceUser(), chan, NULL, *filteredchangelist, filteredmodelist, filteredmsgplists.back());
+ ClientProtocol::Events::Mode::BuildMessages(mode.GetMessages().front().GetSourceUser(), chan, nullptr, *filteredchangelist, filteredmodelist, filteredmsgplists.back());
finalmsgplist = &filteredmsgplists.back();
}
}
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 5b34a0ada..d0a6ae46f 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -250,7 +250,7 @@ public:
Close();
}
- void SendHTTPError(unsigned int response, const char* errstr = NULL)
+ void SendHTTPError(unsigned int response, const char* errstr = nullptr)
{
if (!errstr)
errstr = http_status_str((http_status)response);
diff --git a/src/modules/m_ircv3_batch.cpp b/src/modules/m_ircv3_batch.cpp
index 7d81c60a5..065a543a4 100644
--- a/src/modules/m_ircv3_batch.cpp
+++ b/src/modules/m_ircv3_batch.cpp
@@ -163,7 +163,7 @@ public:
return;
// Mark batch as stopped
- batch.manager = NULL;
+ batch.manager = nullptr;
BatchInfo& batchinfo = *batch.batchinfo;
// Send end batch message to all users who got the batch start message and unset bit so it can be reused
@@ -176,7 +176,7 @@ public:
// erase() not swaperase because the reftag generation logic depends on the order of the elements
stdalgo::erase(active_batches, &batch);
delete batch.batchinfo;
- batch.batchinfo = NULL;
+ batch.batchinfo = nullptr;
}
};
diff --git a/src/modules/m_ircv3_capnotify.cpp b/src/modules/m_ircv3_capnotify.cpp
index 4e2cf1863..9a06189fa 100644
--- a/src/modules/m_ircv3_capnotify.cpp
+++ b/src/modules/m_ircv3_capnotify.cpp
@@ -164,7 +164,7 @@ public:
return;
reloadedmod = mod->ModuleSourceFile;
// Request callback when reload is complete
- cd.add(this, NULL);
+ cd.add(this, nullptr);
}
void OnReloadModuleRestore(Module* mod, void* data) override
@@ -178,7 +178,7 @@ public:
for (const auto& capname : reloadedcaps)
{
if (!capmanager->Find(capname))
- Send(capname, NULL, false);
+ Send(capname, nullptr, false);
}
}
reloadedmod.clear();
diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp
index 89efea12d..96295ed6a 100644
--- a/src/modules/m_ircv3_ctctags.cpp
+++ b/src/modules/m_ircv3_ctctags.cpp
@@ -163,7 +163,7 @@ private:
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()));
if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1))
- target = NULL;
+ target = nullptr;
}
else
{
@@ -240,7 +240,7 @@ public:
// If the message begins with one or more status characters then look them up.
const char* target = parameters[0].c_str();
- PrefixMode* targetpfx = NULL;
+ PrefixMode* targetpfx = nullptr;
for (PrefixMode* pfx; (pfx = ServerInstance->Modes.FindPrefix(target[0])); ++target)
{
// We want the lowest ranked prefix specified.
diff --git a/src/modules/m_ircv3_labeledresponse.cpp b/src/modules/m_ircv3_labeledresponse.cpp
index d4cbbbffe..c90154371 100644
--- a/src/modules/m_ircv3_labeledresponse.cpp
+++ b/src/modules/m_ircv3_labeledresponse.cpp
@@ -171,7 +171,7 @@ public:
}
}
- tag.labeluser = NULL;
+ tag.labeluser = nullptr;
msgcount = 0;
}
diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp
index d52033dd0..def2c6f5e 100644
--- a/src/modules/m_monitor.cpp
+++ b/src/modules/m_monitor.cpp
@@ -178,7 +178,7 @@ public:
Entry* entry = Find(nick);
if (entry)
return &entry->watchers;
- return NULL;
+ return nullptr;
}
static User* FindNick(const std::string& nick)
@@ -186,7 +186,7 @@ public:
User* user = ServerInstance->Users.FindNick(nick);
if ((user) && (user->registered == REG_ALL))
return user;
- return NULL;
+ return nullptr;
}
private:
@@ -197,7 +197,7 @@ private:
NickHash::iterator it = nicks.find(nick);
if (it != nicks.end())
return &it->second;
- return NULL;
+ return nullptr;
}
Entry* AddWatcher(const std::string& nick, LocalUser* user)
@@ -235,7 +235,7 @@ private:
{
ExtData* extdata = ext.Get(user, create);
if (!extdata)
- return NULL;
+ return nullptr;
return &extdata->list;
}
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 99c911fdc..f28a57747 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -104,7 +104,7 @@ public:
modes.push(mh, plus);
}
}
- ServerInstance->Modes.ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS);
+ ServerInstance->Modes.ProcessSingle(src, chan, nullptr, modes, ModeParser::MODE_CHECKACCESS);
return CmdResult::SUCCESS;
}
};
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 7b28bff3f..12b0b306e 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -76,7 +76,7 @@ public:
changelist.push_add(npmh, user->nick);
if (op && opmode)
changelist.push_add(*opmode, user->nick);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, NULL, changelist);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, nullptr, changelist);
}
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index bc8236798..405f0bce0 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -93,7 +93,7 @@ public:
// The user was force joined and OnUserPreJoin() did not run. Set the operprefix now.
Modes::ChangeList changelist;
changelist.push_add(&opm, memb->user->nick);
- ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist);
}
void SetOperPrefix(User* user, bool add)
@@ -101,7 +101,7 @@ public:
Modes::ChangeList changelist;
changelist.push(&opm, add, user->nick);
for (const auto* memb : user->chans)
- ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, nullptr, changelist);
}
void OnPostOper(User* user) override
diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp
index d7f9002a1..517183e1a 100644
--- a/src/modules/m_password_hash.cpp
+++ b/src/modules/m_password_hash.cpp
@@ -57,7 +57,7 @@ public:
std::string salt = ServerInstance->GenRandomStr(hp->out_size, false);
std::string target = hp->hmac(salt, parameters[1]);
- std::string str = Base64::Encode(salt) + "$" + Base64::Encode(target, NULL, 0);
+ std::string str = Base64::Encode(salt) + "$" + Base64::Encode(target, nullptr, 0);
user->WriteNotice(parameters[0] + " hashed password for " + parameters[1] + " is " + str);
return CmdResult::SUCCESS;
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 0095d6696..daf59ff7e 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -69,7 +69,7 @@ public:
if (ZlineOnMatch)
{
ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, MODNAME "@" + ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString());
- if (ServerInstance->XLines->AddLine(zl, NULL))
+ if (ServerInstance->XLines->AddLine(zl, nullptr))
{
if (!duration)
{
@@ -157,7 +157,7 @@ public:
user->WriteNotice("*** Invalid duration for R-line.");
return CmdResult::FAILURE;
}
- XLine *r = NULL;
+ XLine *r = nullptr;
try
{
@@ -273,7 +273,7 @@ public:
ZlineOnMatch = tag->getBool("zlineonmatch");
std::string newrxengine = tag->getString("engine");
- factory = rxfactory ? (rxfactory.operator->()) : NULL;
+ factory = rxfactory ? (rxfactory.operator->()) : nullptr;
rxfactory.SetEngine(newrxengine);
if (!rxfactory)
diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp
index b084eab54..78d9ff4e2 100644
--- a/src/modules/m_rmode.cpp
+++ b/src/modules/m_rmode.cpp
@@ -76,7 +76,7 @@ public:
changelist.push_remove(mh, u->nick);
}
}
- else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != NULL))
+ else if ((lm = mh->IsListModeBase()) && ((ml = lm->GetList(chan)) != nullptr))
{
for (const auto& entry : *ml)
{
@@ -90,7 +90,7 @@ public:
changelist.push_remove(mh);
}
- ServerInstance->Modes.Process(user, chan, NULL, changelist);
+ ServerInstance->Modes.Process(user, chan, nullptr, changelist);
return CmdResult::SUCCESS;
}
};
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 4172f9470..fd2ecb37f 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -64,7 +64,7 @@ public:
// XXX: Make ModeParser clear LastParse
Modes::ChangeList emptychangelist;
- ServerInstance->Modes.ProcessSingle(ServerInstance->FakeClient, NULL, ServerInstance->FakeClient, emptychangelist);
+ ServerInstance->Modes.ProcessSingle(ServerInstance->FakeClient, nullptr, ServerInstance->FakeClient, emptychangelist);
logged = false;
this->active = true;
diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp
index 233524c01..a52a784d3 100644
--- a/src/modules/m_satopic.cpp
+++ b/src/modules/m_satopic.cpp
@@ -53,7 +53,7 @@ public:
return CmdResult::SUCCESS;
}
- target->SetTopic(user, newTopic, ServerInstance->Time(), NULL);
+ target->SetTopic(user, newTopic, ServerInstance->Time(), nullptr);
ServerInstance->SNO.WriteGlobalSno('a', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic);
return CmdResult::SUCCESS;
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp
index 40c8bb80f..d3f12850b 100644
--- a/src/modules/m_spanningtree/addline.cpp
+++ b/src/modules/m_spanningtree/addline.cpp
@@ -42,7 +42,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params)
return CmdResult::FAILURE;
}
- XLine* xl = NULL;
+ XLine* xl = nullptr;
try
{
xl = xlf->Generate(ServerInstance->Time(), ConvToNum<unsigned long>(params[4]), params[2], params[5], params[1]);
@@ -53,7 +53,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params)
return CmdResult::FAILURE;
}
xl->SetCreateTime(ServerCommand::ExtractTS(params[3]));
- if (ServerInstance->XLines->AddLine(xl, NULL))
+ if (ServerInstance->XLines->AddLine(xl, nullptr))
{
if (xl->duration)
{
diff --git a/src/modules/m_spanningtree/encap.cpp b/src/modules/m_spanningtree/encap.cpp
index 00cde72fa..4e4524789 100644
--- a/src/modules/m_spanningtree/encap.cpp
+++ b/src/modules/m_spanningtree/encap.cpp
@@ -43,7 +43,7 @@ CmdResult CommandEncap::Handle(User* user, Params& params)
return CmdResult::SUCCESS;
}
- Command* cmd = NULL;
+ Command* cmd = nullptr;
ServerInstance->Parser.CallHandler(params[1], plist, user, &cmd);
// Discard return value, ENCAP shall succeed even if the command does not exist
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index e5470d9c2..46de08382 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -166,7 +166,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
if (apply_other_sides_modes)
{
ServerInstance->Modes.ModeParamsToChangeList(srcuser, MODETYPE_CHANNEL, params, modechangelist, 2, params.size() - 1);
- ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
+ ServerInstance->Modes.Process(srcuser, chan, nullptr, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
// Reuse for prefix modes
modechangelist.clear();
}
@@ -178,7 +178,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
// Process every member in the message
irc::spacesepstream users(params.back());
std::string item;
- Modes::ChangeList* modechangelistptr = (apply_other_sides_modes ? &modechangelist : NULL);
+ Modes::ChangeList* modechangelistptr = (apply_other_sides_modes ? &modechangelist : nullptr);
while (users.GetToken(item))
{
ProcessModeUUIDPair(item, sourceserver, chan, modechangelistptr, fwdfjoin);
@@ -189,7 +189,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
// Set prefix modes on their users if we lost the FJOIN or had equal TS
if (apply_other_sides_modes)
- ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(srcuser, chan, nullptr, modechangelist, ModeParser::MODE_LOCALONLY);
return CmdResult::SUCCESS;
}
@@ -233,7 +233,7 @@ void CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeServer* sour
}
}
- Membership* memb = chan->ForceJoin(who, NULL, sourceserver->IsBursting());
+ Membership* memb = chan->ForceJoin(who, nullptr, sourceserver->IsBursting());
if (!memb)
{
// User was already on the channel, forward because of the modes they potentially got
@@ -264,7 +264,7 @@ void CommandFJoin::RemoveStatus(Channel* c)
mh->RemoveMode(c, changelist);
}
- ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY);
+ ServerInstance->Modes.Process(ServerInstance->FakeClient, c, nullptr, changelist, ModeParser::MODE_LOCALONLY);
}
void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index e59812efa..789342207 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -54,7 +54,7 @@ CmdResult CommandFMode::Handle(User* who, Params& params)
if ((TS == ourTS) && IS_SERVER(who))
flags |= ModeParser::MODE_MERGE;
- ServerInstance->Modes.Process(who, chan, NULL, changelist, flags);
+ ServerInstance->Modes.Process(who, chan, nullptr, changelist, flags);
return CmdResult::SUCCESS;
}
@@ -97,6 +97,6 @@ CmdResult CommandLMode::Handle(User* who, Params& params)
if (chants == chan->age && IS_SERVER(who))
flags |= ModeParser::MODE_MERGE;
- ServerInstance->Modes.Process(who, chan, NULL, changelist, flags);
+ ServerInstance->Modes.Process(who, chan, nullptr, changelist, flags);
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_spanningtree/ijoin.cpp b/src/modules/m_spanningtree/ijoin.cpp
index 1e756b115..625f0bdfc 100644
--- a/src/modules/m_spanningtree/ijoin.cpp
+++ b/src/modules/m_spanningtree/ijoin.cpp
@@ -49,7 +49,7 @@ CmdResult CommandIJoin::HandleRemote(RemoteUser* user, Params& params)
apply_modes = false;
// Join the user and set the membership id to what they sent
- Membership* memb = chan->ForceJoin(user, apply_modes ? &params[3] : NULL);
+ Membership* memb = chan->ForceJoin(user, apply_modes ? &params[3] : nullptr);
if (!memb)
return CmdResult::FAILURE;
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index b2fa9c2d8..ad45a2746 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -532,7 +532,7 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by
params.add(memb);
params.finalize();
params.Broadcast();
- Utils->SendListLimits(memb->chan, NULL);
+ Utils->SendListLimits(memb->chan, nullptr);
}
else
{
@@ -659,7 +659,7 @@ void ModuleSpanningTree::OnPreRehash(User* user, const std::string &parameter)
{
CmdBuilder params(user ? user : ServerInstance->FakeClient, "REHASH");
params.push(parameter);
- params.Forward(user ? TreeServer::Get(user)->GetRoute() : NULL);
+ params.Forward(user ? TreeServer::Get(user)->GetRoute() : nullptr);
}
}
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index d4edfebef..abbb21efd 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -154,7 +154,7 @@ public:
/** Connect a server locally
*/
- void ConnectServer(std::shared_ptr<Link> x, std::shared_ptr<Autoconnect> y = NULL);
+ void ConnectServer(std::shared_ptr<Link> x, std::shared_ptr<Autoconnect> y = nullptr);
/** Connect the next autoconnect server
*/
diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp
index 2119fae3e..bf7f47aa9 100644
--- a/src/modules/m_spanningtree/metadata.cpp
+++ b/src/modules/m_spanningtree/metadata.cpp
@@ -31,7 +31,7 @@ CmdResult CommandMetadata::Handle(User* srcuser, Params& params)
if (params[0] == "*")
{
std::string value = params.size() < 3 ? "" : params[2];
- FOREACH_MOD(OnDecodeMetaData, (NULL,params[1],value));
+ FOREACH_MOD(OnDecodeMetaData, (nullptr, params[1], value));
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index 4769d8a94..fe0857bd7 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -30,7 +30,7 @@
void ModuleSpanningTree::OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, bool loop)
{
if (result == CmdResult::SUCCESS)
- Utils->RouteCommand(NULL, command, parameters, user);
+ Utils->RouteCommand(nullptr, command, parameters, user);
}
void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscmd, const CommandBase::Params& parameters, User* user)
@@ -105,7 +105,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
std::string message;
if (parameters.size() >= 2)
message.assign(parameters[1]);
- SendChannelMessage(user, c, message, pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : NULL);
+ SendChannelMessage(user, c, message, pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : nullptr);
}
else if (dest[0] == '$')
{
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 6674b67b0..d8369089d 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -83,7 +83,7 @@ void SpanningTreeProtocolInterface::BroadcastEncap(const std::string& cmd, const
// If omit is non-NULL we pass the route belonging to the user to Forward(),
// otherwise we pass NULL, which is equivalent to Broadcast()
- TreeServer* server = (omit ? TreeServer::Get(omit)->GetRoute() : NULL);
+ TreeServer* server = (omit ? TreeServer::Get(omit)->GetRoute() : nullptr);
CmdBuilder(source, "ENCAP * ").push_raw(cmd).insert(params).Forward(server);
}
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index d8b0edc02..535299e72 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -101,7 +101,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params)
if (params.size() < 5)
{
SendError("Protocol error - Not enough parameters for SERVER command");
- return NULL;
+ return nullptr;
}
const std::string& sname = params[0];
@@ -114,7 +114,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params)
if (!ServerInstance->IsSID(sid))
{
this->SendError("Invalid format server ID: "+sid+"!");
- return NULL;
+ return nullptr;
}
for (std::shared_ptr<Link> x : Utils->LinkBlocks)
@@ -129,7 +129,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params)
}
if (!CheckDuplicate(sname, sid))
- return NULL;
+ return nullptr;
const SSLIOHook* const ssliohook = SSLIOHook::IsSSL(this);
if (ssliohook)
@@ -141,7 +141,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params)
else if (capab->remotesa.family() != AF_UNIX && !irc::sockets::cidr_mask("127.0.0.0/8").match(capab->remotesa) && !irc::sockets::cidr_mask("::1/128").match(capab->remotesa))
{
this->SendError("Non-local server connections MUST be linked with SSL!");
- return NULL;
+ return nullptr;
}
ServerInstance->SNO.WriteToSnoMask('l', "Verified server connection " + linkID + " ("+description+")");
@@ -150,7 +150,7 @@ std::shared_ptr<Link> TreeSocket::AuthRemote(const CommandBase::Params& params)
this->SendError("Mismatched server name or password (check the other server's snomask output for details - e.g. user mode +s +Ll)");
ServerInstance->SNO.WriteToSnoMask('l', "Server connection from \002"+sname+"\002 denied, invalid link credentials");
- return NULL;
+ return nullptr;
}
/*
diff --git a/src/modules/m_spanningtree/servercommand.cpp b/src/modules/m_spanningtree/servercommand.cpp
index b4ce6775c..68f21a4aa 100644
--- a/src/modules/m_spanningtree/servercommand.cpp
+++ b/src/modules/m_spanningtree/servercommand.cpp
@@ -52,7 +52,7 @@ ServerCommand* ServerCommandManager::GetHandler(const std::string& command) cons
ServerCommandMap::const_iterator it = commands.find(command);
if (it != commands.end())
return it->second;
- return NULL;
+ return nullptr;
}
bool ServerCommandManager::AddCommand(ServerCommand* cmd)
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index c55021e64..dabf064e6 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -37,8 +37,8 @@
*/
TreeServer::TreeServer()
: Server(ServerInstance->Config->GetSID(), ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc)
- , Parent(NULL), Route(NULL)
- , Socket(NULL)
+ , Parent(nullptr), Route(nullptr)
+ , Socket(nullptr)
, behind_bursting(0)
, pingtimer(this)
, ServerUser(ServerInstance->FakeClient)
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 27e96d50e..85e5de440 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -117,7 +117,7 @@ class TreeSocket final
std::unique_ptr<CapabData> capab; /* Link setup data (held until burst is sent) */
/* The server we are talking to */
- TreeServer* MyRoot = NULL;
+ TreeServer* MyRoot = nullptr;
/** Checks if the given servername and sid are both free
*/
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 0f6cb5d33..bb5633988 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -272,7 +272,7 @@ User* TreeSocket::FindSource(const std::string& prefix, const std::string& comma
}
// Unknown prefix
- return NULL;
+ return nullptr;
}
void TreeSocket::ProcessTag(User* source, const std::string& tag, ClientProtocol::TagMap& tags)
@@ -337,7 +337,7 @@ void TreeSocket::ProcessConnectedLine(std::string& taglist, std::string& prefix,
ServerCommand* scmd = Utils->Creator->CmdManager.GetHandler(command);
CommandBase* cmdbase = scmd;
- Command* cmd = NULL;
+ Command* cmd = nullptr;
if (!scmd)
{
// Not a special server-to-server command
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 1205880b2..7cf345dfd 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -112,12 +112,12 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
* yourself.
*/
Modes::Change modechange(mh, true, params[paramptr++]);
- mh->OnModeChange(_new, _new, NULL, modechange);
+ mh->OnModeChange(_new, _new, nullptr, modechange);
}
else
{
Modes::Change modechange(mh, true, "");
- mh->OnModeChange(_new, _new, NULL, modechange);
+ mh->OnModeChange(_new, _new, nullptr, modechange);
}
_new->SetMode(mh, true);
}
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 1d42af1ea..3afe0fddb 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -34,7 +34,7 @@
#include "resolvers.h"
#include "commandbuilder.h"
-SpanningTreeUtilities* Utils = NULL;
+SpanningTreeUtilities* Utils = nullptr;
ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
{
@@ -67,7 +67,7 @@ TreeServer* SpanningTreeUtilities::FindServer(const std::string &ServerName)
}
else
{
- return NULL;
+ return nullptr;
}
}
@@ -81,7 +81,7 @@ TreeServer* SpanningTreeUtilities::FindServerMask(const std::string &ServerName)
if (InspIRCd::Match(name, ServerName))
return server;
}
- return NULL;
+ return nullptr;
}
TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id)
@@ -90,7 +90,7 @@ TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id)
if (iter != sidlist.end())
return iter->second;
else
- return NULL;
+ return nullptr;
}
TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target)
@@ -103,7 +103,7 @@ TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target)
if (user)
return TreeServer::Get(user);
- return NULL;
+ return nullptr;
}
SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C)
@@ -350,7 +350,7 @@ std::shared_ptr<Link> SpanningTreeUtilities::FindLink(const std::string& name)
return x;
}
}
- return NULL;
+ return nullptr;
}
void SpanningTreeUtilities::SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit)
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index ef97cdc9a..074c1c993 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -172,7 +172,7 @@ public:
/** Sends a PRIVMSG or a NOTICE to a channel obeying an exempt list and an optional prefix
*/
- void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = NULL);
+ void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = nullptr);
// Builds link data to be sent to another server.
std::string BuildLinkString(uint16_t protocol, Module* mod);
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 4ee937496..7a4601289 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -141,11 +141,11 @@ public:
LocalUser* luser = IS_LOCAL(user);
if (!luser || nosslext.Get(luser))
- return NULL;
+ return nullptr;
cert = SSLClientCert::GetCertificate(&luser->eh);
if (!cert)
- return NULL;
+ return nullptr;
SetCertificate(user, cert);
return cert;
@@ -402,7 +402,7 @@ public:
ModResult OnSetConnectClass(LocalUser* user, ConnectClass::Ptr myclass) override
{
ssl_cert* cert = cmd.sslapi.GetCertificate(user);
- const char* error = NULL;
+ const char* error = nullptr;
const std::string requiressl = myclass->config->getString("requiressl");
if (stdalgo::string::equalsci(requiressl, "trusted"))
{
diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp
index fc80b3e68..53819ce72 100644
--- a/src/modules/m_starttls.cpp
+++ b/src/modules/m_starttls.cpp
@@ -76,7 +76,7 @@ public:
*/
user->eh.DoWrite();
- ssl->OnAccept(&user->eh, NULL, NULL);
+ ssl->OnAccept(&user->eh, nullptr, nullptr);
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 3fe06a0b9..09085dabb 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -122,7 +122,7 @@ public:
// Pass the user (instead of ServerInstance->FakeClient) to ModeHandler::Process() to
// make it so that the user sets the mode themselves
- ServerInstance->Modes.Process(user, channel, NULL, setban);
+ ServerInstance->Modes.Process(user, channel, nullptr, setban);
if (ServerInstance->Modes.GetLastChangeList().empty())
{
user->WriteNotice("Invalid ban mask");
diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp
index 64976f4ed..74f8b7b1a 100644
--- a/src/modules/m_websocket.cpp
+++ b/src/modules/m_websocket.cpp
@@ -465,7 +465,7 @@ class WebSocketHook final
key.append(MagicGUID);
std::string reply = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ";
- reply.append(Base64::Encode((*sha1)->GenerateRaw(key), NULL, '=')).append(newline);
+ reply.append(Base64::Encode((*sha1)->GenerateRaw(key), nullptr, '=')).append(newline);
if (!selectedproto.empty())
reply.append("Sec-WebSocket-Protocol: ").append(selectedproto).append(newline);
reply.append(newline);
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index 8d9a8f936..f055ff804 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -224,7 +224,7 @@ public:
XLine* xl = xlf->Generate(ServerInstance->Time(), ConvToNum<unsigned long>(command_p[5]), command_p[3], command_p[6], command_p[2]);
xl->SetCreateTime(ConvToNum<time_t>(command_p[4]));
- if (ServerInstance->XLines->AddLine(xl, NULL))
+ if (ServerInstance->XLines->AddLine(xl, nullptr))
{
ServerInstance->SNO.WriteToSnoMask('x', "database: Added a line of type %s", command_p[1].c_str());
}
diff --git a/src/server.cpp b/src/server.cpp
index acf0f3241..ed7b188b2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -54,7 +54,7 @@ void InspIRCd::Exit(int status)
SetServiceStopped(status);
#endif
this->Cleanup();
- ServerInstance = NULL;
+ ServerInstance = nullptr;
delete this;
QuickExit(status);
}
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index a63ea4c0b..e5c111e68 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -163,20 +163,20 @@ void SocketEngine::DelFdRef(EventHandler *eh)
int fd = eh->GetFd();
if (GetRef(fd) == eh)
{
- ref[fd] = NULL;
+ ref[fd] = nullptr;
CurrentSetSize--;
}
}
bool SocketEngine::HasFd(int fd)
{
- return GetRef(fd) != NULL;
+ return GetRef(fd) != nullptr;
}
EventHandler* SocketEngine::GetRef(int fd)
{
if (fd < 0 || static_cast<unsigned int>(fd) >= ref.size())
- return NULL;
+ return nullptr;
return ref[fd];
}
@@ -369,7 +369,7 @@ std::string SocketEngine::LastError()
#else
char szErrorString[500];
DWORD dwErrorCode = WSAGetLastError();
- if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), NULL) == 0)
+ if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), nullptr) == 0)
sprintf_s(szErrorString, _countof(szErrorString), "Error code: %u", dwErrorCode);
std::string::size_type p;
diff --git a/src/socketengines/kqueue.cpp b/src/socketengines/kqueue.cpp
index 69b63f76b..f5383de00 100644
--- a/src/socketengines/kqueue.cpp
+++ b/src/socketengines/kqueue.cpp
@@ -130,11 +130,11 @@ void SocketEngine::DelFd(EventHandler* eh)
// First remove the write filter ignoring errors, since we can't be
// sure if there are actually any write filters registered.
struct kevent* ke = GetChangeKE();
- EV_SET(ke, eh->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+ EV_SET(ke, eh->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, nullptr);
// Then remove the read filter.
ke = GetChangeKE();
- EV_SET(ke, eh->GetFd(), EVFILT_READ, EV_DELETE, 0, 0, NULL);
+ EV_SET(ke, eh->GetFd(), EVFILT_READ, EV_DELETE, 0, 0, nullptr);
SocketEngine::DelFdRef(eh);
@@ -153,7 +153,7 @@ void SocketEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
{
// removing poll-style write
struct kevent* ke = GetChangeKE();
- EV_SET(ke, eh->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+ EV_SET(ke, eh->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, nullptr);
}
if ((new_mask & (FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE)) && !(old_mask & (FD_WANT_FAST_WRITE | FD_WANT_SINGLE_WRITE)))
{
diff --git a/src/threadsocket.cpp b/src/threadsocket.cpp
index 93fae7f65..86b36eac0 100644
--- a/src/threadsocket.cpp
+++ b/src/threadsocket.cpp
@@ -67,7 +67,7 @@ public:
SocketThread::SocketThread()
{
- socket = NULL;
+ socket = nullptr;
int fd = eventfd(0, EFD_NONBLOCK);
if (fd < 0)
throw CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -127,7 +127,7 @@ public:
SocketThread::SocketThread()
{
- socket = NULL;
+ socket = nullptr;
int fds[2];
if (pipe(fds))
throw CoreException("Could not create pipe " + std::string(strerror(errno)));
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 0e2a4ef4b..96f866f87 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -187,7 +187,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
* besides that, if we get a positive bancache hit, we still won't fuck
* them over if they are exempt. -- w00t
*/
- New->exempt = (ServerInstance->XLines->MatchesLine("E",New) != NULL);
+ New->exempt = (ServerInstance->XLines->MatchesLine("E",New) != nullptr);
BanCacheHit* const b = ServerInstance->BanCache.GetHit(New->GetIPString());
if (b)
diff --git a/src/users.cpp b/src/users.cpp
index 9ae86f954..3e47a9aae 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -395,7 +395,7 @@ void User::Oper(std::shared_ptr<OperInfo> info)
{
Modes::ChangeList changelist;
changelist.push_add(opermh);
- ClientProtocol::Events::Mode modemsg(ServerInstance->FakeClient, NULL, localuser, changelist);
+ ClientProtocol::Events::Mode modemsg(ServerInstance->FakeClient, nullptr, localuser, changelist);
localuser->Send(modemsg);
}
@@ -462,7 +462,7 @@ void User::UnOper()
* note, order is important - this must come before modes as -o attempts
* to call UnOper. -- w00t
*/
- oper = NULL;
+ oper = nullptr;
// Remove the user from the oper list
stdalgo::vector::swaperase(ServerInstance->Users.all_opers, this);
@@ -480,7 +480,7 @@ void User::UnOper()
changelist.push_remove(mh);
}
- ServerInstance->Modes.Process(this, NULL, this, changelist);
+ ServerInstance->Modes.Process(this, nullptr, this, changelist);
ModeHandler* opermh = ServerInstance->Modes.FindMode('o', MODETYPE_USER);
if (opermh)
@@ -536,7 +536,7 @@ void LocalUser::CheckClass(bool clone_count)
bool LocalUser::CheckLines(bool doZline)
{
- const char* check[] = { "G" , "K", (doZline) ? "Z" : NULL, NULL };
+ const char* check[] = { "G" , "K", (doZline) ? "Z" : nullptr, nullptr };
if (!this->exempt)
{
@@ -566,7 +566,7 @@ void LocalUser::FullConnect()
* may put the user into a totally separate class with different restrictions! so we *must* check again.
* Don't remove this! -- w00t
*/
- connectclass = NULL;
+ connectclass = nullptr;
SetClass();
CheckClass();
CheckLines();
@@ -781,7 +781,7 @@ void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa)
ServerInstance->Users.AddClone(this);
// Recheck the connect class.
- this->connectclass = NULL;
+ this->connectclass = nullptr;
this->SetClass();
this->CheckClass();
diff --git a/src/xline.cpp b/src/xline.cpp
index e8b2f2b6a..6b3beea9a 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -192,7 +192,7 @@ XLineLookup* XLineManager::GetAll(const std::string &type)
ContainerIter n = lookup_lines.find(type);
if (n == lookup_lines.end())
- return NULL;
+ return nullptr;
LookupIter safei;
const time_t current = ServerInstance->Time();
@@ -363,7 +363,7 @@ XLine* XLineManager::MatchesLine(const std::string &type, User* user)
ContainerIter x = lookup_lines.find(type);
if (x == lookup_lines.end())
- return NULL;
+ return nullptr;
const time_t current = ServerInstance->Time();
@@ -389,7 +389,7 @@ XLine* XLineManager::MatchesLine(const std::string &type, User* user)
i = safei;
}
- return NULL;
+ return nullptr;
}
XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pattern)
@@ -397,7 +397,7 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat
ContainerIter x = lookup_lines.find(type);
if (x == lookup_lines.end())
- return NULL;
+ return nullptr;
const time_t current = ServerInstance->Time();
@@ -424,7 +424,7 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat
i = safei;
}
- return NULL;
+ return nullptr;
}
// removes lines that have expired
@@ -766,7 +766,7 @@ XLineFactory* XLineManager::GetFactory(const std::string &type)
XLineFactMap::iterator n = line_factory.find(type);
if (n == line_factory.end())
- return NULL;
+ return nullptr;
return n->second;
}
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index 045995e29..227ee5572 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -30,7 +30,7 @@
CWin32Exception::CWin32Exception() : exception()
{
dwErrorCode = GetLastError();
- if( FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), NULL) == 0 )
+ if( FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)szErrorString, _countof(szErrorString), nullptr) == 0 )
sprintf_s(szErrorString, _countof(szErrorString), "Error code: %u", dwErrorCode);
for (size_t i = 0; i < _countof(szErrorString); i++)
{
diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h
index a2571efa4..6fe4ccf94 100644
--- a/win/inspircd_win32wrapper.h
+++ b/win/inspircd_win32wrapper.h
@@ -162,7 +162,7 @@ struct WindowsIOVec final
inline ssize_t writev(int fd, const WindowsIOVec* iov, int count)
{
DWORD sent;
- int ret = WSASend(fd, reinterpret_cast<LPWSABUF>(const_cast<WindowsIOVec*>(iov)), count, &sent, 0, NULL, NULL);
+ int ret = WSASend(fd, reinterpret_cast<LPWSABUF>(const_cast<WindowsIOVec*>(iov)), count, &sent, 0, nullptr, nullptr);
if (ret == 0)
return sent;
return -1;
diff --git a/win/win32service.cpp b/win/win32service.cpp
index b3a1f23a4..5fec71302 100644
--- a/win/win32service.cpp
+++ b/win/win32service.cpp
@@ -111,7 +111,7 @@ VOID ServiceMain(DWORD argc, LPCSTR *argv)
return;
char szModuleName[MAX_PATH];
- if(GetModuleFileNameA(NULL, szModuleName, MAX_PATH))
+ if(GetModuleFileNameA(nullptr, szModuleName, MAX_PATH))
{
if(!argc)
argc = 1;
@@ -134,11 +134,11 @@ VOID ServiceMain(DWORD argc, LPCSTR *argv)
strcpy_s(g_ServiceData.argv[i], allocsize, argv[i]);
}
- *(strrchr(szModuleName, '\\') + 1) = NULL;
+ *(strrchr(szModuleName, '\\') + 1) = '\0';
SetCurrentDirectoryA(szModuleName);
- HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkerThread, NULL, 0, NULL);
- if (hThread != NULL)
+ HANDLE hThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)WorkerThread, nullptr, 0, nullptr);
+ if (hThread != nullptr)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
@@ -166,7 +166,7 @@ void InstallService()
try {
TCHAR tszBinaryPath[MAX_PATH];
- if(!GetModuleFileName(NULL, tszBinaryPath, _countof(tszBinaryPath)))
+ if(!GetModuleFileName(nullptr, tszBinaryPath, _countof(tszBinaryPath)))
{
throw CWin32Exception();
}
@@ -178,7 +178,7 @@ void InstallService()
}
InspServiceHandle = CreateService(SCMHandle, TEXT("InspIRCd"),TEXT("InspIRCd Daemon"), SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS,
- SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, tszBinaryPath, 0, 0, 0, TEXT("NT AUTHORITY\\NetworkService"), NULL);
+ SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, tszBinaryPath, 0, 0, 0, TEXT("NT AUTHORITY\\NetworkService"), nullptr);
if (!InspServiceHandle)
{
@@ -215,7 +215,7 @@ void UninstallService()
try
{
- SCMHandle = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, DELETE);
+ SCMHandle = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, DELETE);
if (!SCMHandle)
throw CWin32Exception();
@@ -268,7 +268,7 @@ int main(int argc, char* argv[])
SERVICE_TABLE_ENTRY serviceTable[] =
{
{ TEXT("InspIRCd"), (LPSERVICE_MAIN_FUNCTION)ServiceMain },
- { NULL, NULL }
+ { nullptr, nullptr }
};
g_bRunningAsService = true;