From f9911dde529adf3dc03f4f14bbd70756ac2f665c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 2 Mar 2025 14:51:02 +0000 Subject: 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. --- include/config.h | 8 ++++---- include/modules.h | 2 +- include/modules/sasl.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include') 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 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("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get("maxlogins"); if (maxlogins && na->nc->users.size() >= maxlogins) return OnFail(); -- cgit