diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-02 14:51:02 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-02 15:27:47 +0000 |
commit | f9911dde529adf3dc03f4f14bbd70756ac2f665c (patch) | |
tree | 7c720e4f82fdb30b7d8a22fc0809f50bc862fae3 /modules/extra/mysql.cpp | |
parent | a5e5eb5eb084e8343260ce7bc26ea86798f64fe1 (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.
Diffstat (limited to 'modules/extra/mysql.cpp')
-rw-r--r-- | modules/extra/mysql.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
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<Anope::string, MySQLService *>::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<const Anope::string>("name", "mysql/main") == cname) + for (i = 0; i < Config->CountBlock("mysql"); ++i) + if (config.GetBlock("mysql", i).Get<const Anope::string>("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<const Anope::string>("name", "mysql/main"); + Configuration::Block &block = config.GetBlock("mysql", i); + const Anope::string &connname = block.Get<const Anope::string>("name", "mysql/main"); if (this->MySQLServices.find(connname) == this->MySQLServices.end()) { - const Anope::string &database = block->Get<const Anope::string>("database", "anope"); - const Anope::string &server = block->Get<const Anope::string>("server", "127.0.0.1"); - const Anope::string &user = block->Get<const Anope::string>("username", "anope"); - const Anope::string &password = block->Get<const Anope::string>("password"); - unsigned int port = block->Get<unsigned int>("port", "3306"); - const Anope::string &socket = block->Get<const Anope::string>("socket"); + const Anope::string &database = block.Get<const Anope::string>("database", "anope"); + const Anope::string &server = block.Get<const Anope::string>("server", "127.0.0.1"); + const Anope::string &user = block.Get<const Anope::string>("username", "anope"); + const Anope::string &password = block.Get<const Anope::string>("password"); + unsigned int port = block.Get<unsigned int>("port", "3306"); + const Anope::string &socket = block.Get<const Anope::string>("socket"); try { |