diff options
| author | 2021-12-03 13:37:42 +0000 | |
|---|---|---|
| committer | 2021-12-03 13:37:42 +0000 | |
| commit | 2466c048e26c09461b4ced2a9dfcf6d87f0e1323 (patch) | |
| tree | a4575894c6945acef81eb3dd91a206879dbec2ac /src | |
| parent | Fix a bunch of cases where module types were not marked as final. (diff) | |
Consistently use `!foo` instead of `foo == NULL`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coremods/core_dns.cpp | 2 | ||||
| -rw-r--r-- | src/coremods/core_hostname_lookup.cpp | 2 | ||||
| -rw-r--r-- | src/coremods/core_who.cpp | 2 | ||||
| -rw-r--r-- | src/logger.cpp | 2 | ||||
| -rw-r--r-- | src/modules/extra/m_ldap.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 2 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 4 | ||||
| -rw-r--r-- | src/modules/m_filter.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_hostcycle.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_rmode.cpp | 4 | ||||
| -rw-r--r-- | src/modules/m_sasl.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_servprotect.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 2 |
14 files changed, 17 insertions, 17 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 96906bb77..66a286f0b 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -656,7 +656,7 @@ class MyManager final // recv_packet.id must be filled in here DNS::Request* request = this->requests[recv_packet.id]; - if (request == NULL) + if (!request) { ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Received an answer for something we didn't request"); return; diff --git a/src/coremods/core_hostname_lookup.cpp b/src/coremods/core_hostname_lookup.cpp index bd55108db..a153891e0 100644 --- a/src/coremods/core_hostname_lookup.cpp +++ b/src/coremods/core_hostname_lookup.cpp @@ -77,7 +77,7 @@ class UserResolver final return; const DNS::ResourceRecord* ans_record = r->FindAnswerOfType(this->question.type); - if (ans_record == NULL) + if (!ans_record) { HandleError(bound_user, "Could not resolve your hostname: No " + this->manager->GetTypeStr(this->question.type) + " records found"); return; diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index f475a7abe..28c23180a 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -52,7 +52,7 @@ struct WhoData final if (!whox) { const char* pos = strchr(who_field_order, flag); - if (pos == NULL) + if (!pos) return false; out = pos - who_field_order; diff --git a/src/logger.cpp b/src/logger.cpp index d6c571af8..3c0985841 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -299,7 +299,7 @@ FileWriter::FileWriter(FILE* logfile, unsigned int flushcount) void FileWriter::WriteLogLine(const std::string &line) { - if (log == NULL) + if (!log) return; // XXX: For now, just return. Don't throw an exception. It'd be nice to find out if this is happening, but I'm terrified of breaking so close to final release. -- w00t // throw CoreException("FileWriter::WriteLogLine called with a closed logfile"); diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index 65aca4348..fd3a40148 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -370,7 +370,7 @@ class LDAPService final void Search(LDAPInterface* i, const std::string& base, const std::string& filter) override { - if (i == NULL) + if (!i) throw LDAPException("No interface"); LDAPSearch* s = new LDAPSearch(this, i, base, searchscope, filter); @@ -413,7 +413,7 @@ class LDAPService final return; } - if (req->message == NULL) + if (!req->message) { return; } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 2905794f1..05a7a95fe 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -711,7 +711,7 @@ class GnuTLSIOHook final unsigned int cert_list_size = 0; const gnutls_datum_t* cert_list = gnutls_certificate_get_peers(this->sess, &cert_list_size); - if (cert_list == NULL) + if (!cert_list) { certinfo->error = "No certificate was found"; goto info_done_dealloc; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index e70046ea4..7036553f4 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -81,7 +81,7 @@ namespace OpenSSL DHParams(const std::string& filename) { BIO* dhpfile = BIO_new_file(filename.c_str(), "r"); - if (dhpfile == NULL) + if (!dhpfile) throw Exception("Couldn't open DH file " + filename); dh = PEM_read_bio_DHparams(dhpfile, NULL, NULL, NULL); @@ -359,7 +359,7 @@ namespace OpenSSL const std::string hash = tag->getString("hash", "sha256", 1); digest = EVP_get_digestbyname(hash.c_str()); - if (digest == NULL) + if (!digest) throw Exception("Unknown hash type " + hash); const std::string ciphers = tag->getString("ciphers"); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 27a8b85c0..f32da94ca 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -737,7 +737,7 @@ void ModuleFilter::OnSyncNetwork(ProtocolInterface::Server& server) void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata) { - if ((target == NULL) && (extname == "filter")) + if ((!target) && (extname == "filter")) { try { diff --git a/src/modules/m_hostcycle.cpp b/src/modules/m_hostcycle.cpp index f30b51993..6f0300c3d 100644 --- a/src/modules/m_hostcycle.cpp +++ b/src/modules/m_hostcycle.cpp @@ -73,7 +73,7 @@ class ModuleHostCycle final for (const auto& [chanuser, _] : c->GetUsers()) { LocalUser* u = IS_LOCAL(chanuser); - if (u == NULL || u == user) + if (!u || u == user) continue; if (u->already_sent == silent_id) continue; diff --git a/src/modules/m_rmode.cpp b/src/modules/m_rmode.cpp index 5690bdb35..9b3fc6cec 100644 --- a/src/modules/m_rmode.cpp +++ b/src/modules/m_rmode.cpp @@ -39,14 +39,14 @@ class CommandRMode final Channel* chan = ServerInstance->Channels.Find(parameters[0]); char modeletter = parameters[1][0]; - if (chan == NULL) + if (!chan) { user->WriteNotice("The channel " + parameters[0] + " does not exist."); return CmdResult::FAILURE; } mh = ServerInstance->Modes.FindMode(modeletter, MODETYPE_CHANNEL); - if (mh == NULL || parameters[1].size() > 1) + if (!mh || parameters[1].size() > 1) { user->WriteNotice(parameters[1] + " is not a valid channel mode."); return CmdResult::FAILURE; diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index b2c2beaf2..989d2c8da 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -439,7 +439,7 @@ class ModuleSASL final void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string& extdata) override { - if ((target == NULL) && (extname == "saslmechlist")) + if ((!target) && (extname == "saslmechlist")) cap.SetMechlist(extdata); } }; diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index feb9aa6ba..3ed739212 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -104,7 +104,7 @@ class ModuleServProtectMode final ModResult OnKill(User* src, User* dst, const std::string &reason) override { - if (src == NULL) + if (!src) return MOD_RES_PASSTHRU; if (dst->IsModeSet(bm)) diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index c945240f1..bc7595eb6 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -153,7 +153,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params) // XXX: If the channel does not exist in the chan hash at this point, create it so the remote modes can be applied on it. // This happens to 0-user permanent channels on the losing side, because those are removed (from the chan hash, then // deleted later) as soon as the permchan mode is removed from them. - if (ServerInstance->Channels.Find(channel) == NULL) + if (!ServerInstance->Channels.Find(channel)) { chan = new Channel(channel, TS); } diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index 82aaa1f3c..966dbf9d1 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -132,7 +132,7 @@ class TreeServer final /** Returns true if this server is the tree root (i.e.: us) */ - bool IsRoot() const { return (this->Parent == NULL); } + bool IsRoot() const { return (!this->Parent); } /** Returns true if this server is locally connected */ |
