summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-03-02 14:51:02 +0000
committerSadie Powell <sadie@witchery.services>2025-03-02 15:27:47 +0000
commitf9911dde529adf3dc03f4f14bbd70756ac2f665c (patch)
tree7c720e4f82fdb30b7d8a22fc0809f50bc862fae3
parenta5e5eb5eb084e8343260ce7bc26ea86798f64fe1 (diff)
Return references instead of pointers from the config system.
We used to return NULL from these methods but now we return an empty block so this can never actually be null now.
-rw-r--r--include/config.h8
-rw-r--r--include/modules.h2
-rw-r--r--include/modules/sasl.h2
-rw-r--r--modules/botserv/botserv.cpp30
-rw-r--r--modules/botserv/bs_autoassign.cpp2
-rw-r--r--modules/botserv/bs_badwords.cpp4
-rw-r--r--modules/botserv/bs_kick.cpp10
-rw-r--r--modules/botserv/bs_set.cpp4
-rw-r--r--modules/chanserv/chanserv.cpp32
-rw-r--r--modules/chanserv/cs_access.cpp20
-rw-r--r--modules/chanserv/cs_akick.cpp8
-rw-r--r--modules/chanserv/cs_ban.cpp12
-rw-r--r--modules/chanserv/cs_clone.cpp2
-rw-r--r--modules/chanserv/cs_entrymsg.cpp2
-rw-r--r--modules/chanserv/cs_fantasy_stats.cpp6
-rw-r--r--modules/chanserv/cs_fantasy_top.cpp6
-rw-r--r--modules/chanserv/cs_flags.cpp16
-rw-r--r--modules/chanserv/cs_kick.cpp4
-rw-r--r--modules/chanserv/cs_list.cpp6
-rw-r--r--modules/chanserv/cs_log.cpp14
-rw-r--r--modules/chanserv/cs_mode.cpp18
-rw-r--r--modules/chanserv/cs_register.cpp2
-rw-r--r--modules/chanserv/cs_seen.cpp6
-rw-r--r--modules/chanserv/cs_set.cpp18
-rw-r--r--modules/chanserv/cs_set_misc.cpp14
-rw-r--r--modules/chanserv/cs_suspend.cpp6
-rw-r--r--modules/chanserv/cs_xop.cpp24
-rw-r--r--modules/chanstats.cpp20
-rw-r--r--modules/database/db_atheme.cpp18
-rw-r--r--modules/database/db_flatfile.cpp18
-rw-r--r--modules/database/db_old.cpp2
-rw-r--r--modules/database/db_redis.cpp6
-rw-r--r--modules/database/db_sql.cpp10
-rw-r--r--modules/database/db_sql_live.cpp10
-rw-r--r--modules/dns.cpp26
-rw-r--r--modules/dnsbl.cpp38
-rw-r--r--modules/encryption/enc_bcrypt.cpp6
-rw-r--r--modules/encryption/enc_sha2.cpp4
-rw-r--r--modules/extra/enc_argon2.cpp16
-rw-r--r--modules/extra/ldap.cpp22
-rw-r--r--modules/extra/mysql.cpp28
-rw-r--r--modules/extra/sqlite.cpp16
-rw-r--r--modules/extra/ssl_gnutls.cpp14
-rw-r--r--modules/extra/ssl_openssl.cpp18
-rw-r--r--modules/extra/xmlrpc.cpp4
-rw-r--r--modules/fantasy.cpp4
-rw-r--r--modules/global/gl_queue.cpp2
-rw-r--r--modules/global/global.cpp12
-rw-r--r--modules/help.cpp4
-rw-r--r--modules/helpchan.cpp2
-rw-r--r--modules/hostserv/hostserv.cpp10
-rw-r--r--modules/hostserv/hs_group.cpp8
-rw-r--r--modules/hostserv/hs_list.cpp2
-rw-r--r--modules/hostserv/hs_request.cpp16
-rw-r--r--modules/httpd.cpp22
-rw-r--r--modules/irc2sql/irc2sql.cpp16
-rw-r--r--modules/irc2sql/irc2sql.h2
-rw-r--r--modules/ldap_authentication.cpp22
-rw-r--r--modules/ldap_oper.cpp14
-rw-r--r--modules/memoserv/memoserv.cpp18
-rw-r--r--modules/memoserv/ms_ignore.cpp2
-rw-r--r--modules/memoserv/ms_rsend.cpp4
-rw-r--r--modules/memoserv/ms_send.cpp2
-rw-r--r--modules/memoserv/ms_set.cpp4
-rw-r--r--modules/nickserv/nickserv.cpp56
-rw-r--r--modules/nickserv/ns_ajoin.cpp4
-rw-r--r--modules/nickserv/ns_cert.cpp10
-rw-r--r--modules/nickserv/ns_drop.cpp4
-rw-r--r--modules/nickserv/ns_group.cpp14
-rw-r--r--modules/nickserv/ns_identify.cpp2
-rw-r--r--modules/nickserv/ns_list.cpp4
-rw-r--r--modules/nickserv/ns_maxemail.cpp6
-rw-r--r--modules/nickserv/ns_recover.cpp8
-rw-r--r--modules/nickserv/ns_register.cpp48
-rw-r--r--modules/nickserv/ns_resetpass.cpp10
-rw-r--r--modules/nickserv/ns_set.cpp32
-rw-r--r--modules/nickserv/ns_set_keepmodes.cpp2
-rw-r--r--modules/nickserv/ns_set_kill.cpp4
-rw-r--r--modules/nickserv/ns_set_misc.cpp12
-rw-r--r--modules/nickserv/ns_suspend.cpp8
-rw-r--r--modules/operserv/operserv.cpp6
-rw-r--r--modules/operserv/os_akill.cpp14
-rw-r--r--modules/operserv/os_chankill.cpp4
-rw-r--r--modules/operserv/os_config.cpp14
-rw-r--r--modules/operserv/os_defcon.cpp47
-rw-r--r--modules/operserv/os_dns.cpp18
-rw-r--r--modules/operserv/os_forbid.cpp8
-rw-r--r--modules/operserv/os_ignore.cpp2
-rw-r--r--modules/operserv/os_info.cpp2
-rw-r--r--modules/operserv/os_kill.cpp2
-rw-r--r--modules/operserv/os_list.cpp4
-rw-r--r--modules/operserv/os_logsearch.cpp2
-rw-r--r--modules/operserv/os_news.cpp16
-rw-r--r--modules/operserv/os_session.cpp22
-rw-r--r--modules/operserv/os_set.cpp2
-rw-r--r--modules/operserv/os_shutdown.cpp18
-rw-r--r--modules/operserv/os_stats.cpp6
-rw-r--r--modules/operserv/os_sxline.cpp26
-rw-r--r--modules/protocol/hybrid.cpp2
-rw-r--r--modules/protocol/inspircd.cpp6
-rw-r--r--modules/proxyscan.cpp34
-rw-r--r--modules/redis.cpp16
-rw-r--r--modules/regex_stdlib.cpp6
-rw-r--r--modules/rewrite.cpp16
-rw-r--r--modules/rpc/jsonrpc.cpp4
-rw-r--r--modules/sasl.cpp8
-rw-r--r--modules/sql_authentication.cpp12
-rw-r--r--modules/sql_log.cpp6
-rw-r--r--modules/sql_oper.cpp8
-rw-r--r--modules/webcpanel/pages/register.cpp2
-rw-r--r--modules/webcpanel/webcpanel.cpp8
-rw-r--r--src/command.cpp2
-rw-r--r--src/config.cpp227
-rw-r--r--src/init.cpp36
-rw-r--r--src/language.cpp2
-rw-r--r--src/mail.cpp26
-rw-r--r--src/main.cpp4
-rw-r--r--src/messages.cpp6
-rw-r--r--src/misc.cpp2
-rw-r--r--src/modulemanager.cpp2
-rw-r--r--src/protocol.cpp18
-rw-r--r--src/uplink.cpp6
-rw-r--r--src/users.cpp6
-rw-r--r--src/xline.cpp4
124 files changed, 814 insertions, 812 deletions
diff --git a/include/config.h b/include/config.h
index 2f4f1b953..d705fd422 100644
--- a/include/config.h
+++ b/include/config.h
@@ -41,7 +41,7 @@ namespace Configuration
Block(const Anope::string &);
const Anope::string &GetName() const;
int CountBlock(const Anope::string &name) const;
- const Block *GetBlock(const Anope::string &name, int num = 0) const;
+ const Block &GetBlock(const Anope::string &name, int num = 0) const;
Block *GetMutableBlock(const Anope::string &name, int num = 0);
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
@@ -126,12 +126,12 @@ namespace Configuration
void LoadConf(File &file);
void Post(Conf *old);
- Block *GetModule(const Module *);
- Block *GetModule(const Anope::string &name);
+ Block &GetModule(const Module *);
+ Block &GetModule(const Anope::string &name);
BotInfo *GetClient(const Anope::string &name);
- const Block *GetCommand(CommandSource &);
+ const Block &GetCommand(CommandSource &);
};
struct Uplink final
diff --git a/include/modules.h b/include/modules.h
index 12637b1b4..8a7702ac7 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -305,7 +305,7 @@ public:
* @param conf The config that is being built now and will replace the global Config object
* @throws A ConfigException to abort the config (re)loading process.
*/
- virtual void OnReload(Configuration::Conf *conf) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
+ virtual void OnReload(Configuration::Conf &conf) { throw NotImplementedException(); }
/** Called before a bot is assigned to a channel.
* @param sender The user assigning the bot
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
index d051e2e61..5f8d0e9c3 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -121,7 +121,7 @@ namespace SASL
if (!na || na->nc->HasExt("NS_SUSPENDED") || na->nc->HasExt("UNCONFIRMED"))
return OnFail();
- unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
+ unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
if (maxlogins && na->nc->users.size() >= maxlogins)
return OnFail();
diff --git a/modules/botserv/botserv.cpp b/modules/botserv/botserv.cpp
index 0646668be..e77ffe46c 100644
--- a/modules/botserv/botserv.cpp
+++ b/modules/botserv/botserv.cpp
@@ -23,9 +23,9 @@ public:
{
}
- void OnReload(Configuration::Conf *conf) override
+ void OnReload(Configuration::Conf &conf) override
{
- const Anope::string &bsnick = conf->GetModule(this)->Get<const Anope::string>("client");
+ const Anope::string &bsnick = conf.GetModule(this).Get<const Anope::string>("client");
BotServ = BotInfo::Find(bsnick, true);
}
@@ -34,7 +34,7 @@ public:
/* Do not allow removing bot modes on our service bots */
if (chan->ci && chan->ci->bi == user)
{
- const Anope::string &botmodes = Config->GetModule(this)->Get<const Anope::string>("botmodes");
+ const Anope::string &botmodes = Config->GetModule(this).Get<const Anope::string>("botmodes");
for (auto botmode : botmodes)
chan->SetMode(chan->ci->bi, ModeManager::FindChannelModeByChar(botmode), chan->ci->bi->GetUID());
}
@@ -42,9 +42,9 @@ public:
void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) override
{
- if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers"))
+ if (ci->c && ci->c->users.size() >= Config->GetModule(this).Get<unsigned>("minusers"))
{
- ChannelStatus status(Config->GetModule(this)->Get<const Anope::string>("botmodes"));
+ ChannelStatus status(Config->GetModule(this).Get<const Anope::string>("botmodes"));
bi->Join(ci->c, &status);
}
}
@@ -55,7 +55,7 @@ public:
return;
BotInfo *bi = user->server == Me ? dynamic_cast<BotInfo *>(user) : NULL;
- if (b