diff options
author | Sadie Powell <sadie@witchery.services> | 2020-12-04 17:43:47 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-12-04 18:06:42 +0000 |
commit | ffacccbb6fe800950af8b5914cbf5ebd3ecad99c (patch) | |
tree | b909624c14dfcb52a816303afcc36fa72d992c56 | |
parent | eda0e5e2f0509a3eea823f64c4acea8ac970b9a4 (diff) |
Add a typedef for the data provider map.
-rw-r--r-- | include/modules.h | 3 | ||||
-rw-r--r-- | src/modules.cpp | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/include/modules.h b/include/modules.h index a6450547c..c4508d81a 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1050,6 +1050,7 @@ class CoreExport Module : public classbase, public usecountbase class CoreExport ModuleManager : public fakederef<ModuleManager> { public: + typedef std::multimap<std::string, ServiceProvider*, irc::insensitive_swo> DataProviderMap; typedef std::vector<ServiceProvider*> ServiceList; private: @@ -1092,7 +1093,7 @@ class CoreExport ModuleManager : public fakederef<ModuleManager> Module::List EventHandlers[I_END]; /** List of data services keyed by name */ - std::multimap<std::string, ServiceProvider*, irc::insensitive_swo> DataProviders; + DataProviderMap DataProviders; /** A list of ServiceProviders waiting to be registered. * Non-NULL when constructing a Module, NULL otherwise. diff --git a/src/modules.cpp b/src/modules.cpp index a39fcb6c1..07ded8209 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -425,9 +425,9 @@ void ModuleManager::DoSafeUnload(Module* mod) user->doUnhookExtensions(items); } - for(std::multimap<std::string, ServiceProvider*>::iterator i = DataProviders.begin(); i != DataProviders.end(); ) + for (DataProviderMap::iterator i = DataProviders.begin(); i != DataProviders.end(); ) { - std::multimap<std::string, ServiceProvider*>::iterator curr = i++; + DataProviderMap::iterator curr = i++; if (curr->second->creator == mod) { DataProviders.erase(curr); @@ -642,7 +642,7 @@ ServiceProvider* ModuleManager::FindService(ServiceType type, const std::string& case SERVICE_DATA: case SERVICE_IOHOOK: { - std::multimap<std::string, ServiceProvider*>::iterator i = DataProviders.find(name); + DataProviderMap::iterator i = DataProviders.find(name); if (i != DataProviders.end() && i->second->service == type) return i->second; return NULL; @@ -696,7 +696,7 @@ void dynamic_reference_base::resolve() { // Because find() may return any element with a matching key in case count(key) > 1 use lower_bound() // to ensure a dynref with the same name as another one resolves to the same object - std::multimap<std::string, ServiceProvider*>::iterator i = ServerInstance->Modules.DataProviders.lower_bound(name); + ModuleManager::DataProviderMap::iterator i = ServerInstance->Modules.DataProviders.lower_bound(name); if ((i != ServerInstance->Modules.DataProviders.end()) && (i->first == this->name)) { ServiceProvider* newvalue = i->second; @@ -729,7 +729,7 @@ void ModuleManager::AddReferent(const std::string& name, ServiceProvider* servic void ModuleManager::DelReferent(ServiceProvider* service) { - for (std::multimap<std::string, ServiceProvider*>::iterator i = DataProviders.begin(); i != DataProviders.end(); ) + for (DataProviderMap::iterator i = DataProviders.begin(); i != DataProviders.end(); ) { ServiceProvider* curr = i->second; if (curr == service) |