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. --- modules/extra/mysql.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'modules/extra/mysql.cpp') diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp index 65fe6d5c4..0d39c87a4 100644 --- a/modules/extra/mysql.cpp +++ b/modules/extra/mysql.cpp @@ -260,9 +260,9 @@ public: delete DThread; } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - Configuration::Block *config = conf->GetModule(this); + Configuration::Block &config = conf.GetModule(this); for (std::map::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end();) { @@ -272,11 +272,11 @@ public: ++it; - for (i = 0; i < config->CountBlock("mysql"); ++i) - if (config->GetBlock("mysql", i)->Get("name", "mysql/main") == cname) + for (i = 0; i < Config->CountBlock("mysql"); ++i) + if (config.GetBlock("mysql", i).Get("name", "mysql/main") == cname) break; - if (i == config->CountBlock("mysql")) + if (i == Config->CountBlock("mysql")) { Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname; @@ -285,19 +285,19 @@ public: } } - for (int i = 0; i < config->CountBlock("mysql"); ++i) + for (int i = 0; i < Config->CountBlock("mysql"); ++i) { - Configuration::Block *block = config->GetBlock("mysql", i); - const Anope::string &connname = block->Get("name", "mysql/main"); + Configuration::Block &block = config.GetBlock("mysql", i); + const Anope::string &connname = block.Get("name", "mysql/main"); if (this->MySQLServices.find(connname) == this->MySQLServices.end()) { - const Anope::string &database = block->Get("database", "anope"); - const Anope::string &server = block->Get("server", "127.0.0.1"); - const Anope::string &user = block->Get("username", "anope"); - const Anope::string &password = block->Get("password"); - unsigned int port = block->Get("port", "3306"); - const Anope::string &socket = block->Get("socket"); + const Anope::string &database = block.Get("database", "anope"); + const Anope::string &server = block.Get("server", "127.0.0.1"); + const Anope::string &user = block.Get("username", "anope"); + const Anope::string &password = block.Get("password"); + unsigned int port = block.Get("port", "3306"); + const Anope::string &socket = block.Get("socket"); try { -- cgit