aboutsummaryrefslogtreecommitdiff
path: root/src/cull.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-07-30 17:21:47 +0100
committerGravatar Sadie Powell2022-07-30 19:15:41 +0100
commit3c455a8511f8c72552afb6ebe35a8e7c9b9af979 (patch)
tree603c14aa8d8dfafb931cf3ca1b3503fdfc979528 /src/cull.cpp
parentAdd support for clearing the target of a dynamic_reference. (diff)
Modernize various minor legacy C++isms.
Diffstat (limited to 'src/cull.cpp')
-rw-r--r--src/cull.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/cull.cpp b/src/cull.cpp
index 4810eee84..757fbb99f 100644
--- a/src/cull.cpp
+++ b/src/cull.cpp
@@ -60,7 +60,7 @@ Cullable::Result Cullable::Cull()
typeid(*this).name(), static_cast<void*>(this));
}
#endif
- return Result();
+ return {};
}
void CullList::Apply()
@@ -77,12 +77,12 @@ void CullList::Apply()
}
working.clear();
}
+
std::set<Cullable*> gone;
std::vector<Cullable*> queue;
queue.reserve(list.size() + 32);
- for(unsigned int i=0; i < list.size(); i++)
+ for (auto& c : list)
{
- Cullable* c = list[i];
if (gone.insert(c).second)
{
#ifdef INSPIRCD_ENABLE_RTTI
@@ -106,11 +106,10 @@ void CullList::Apply()
}
}
list.clear();
- for(unsigned int i=0; i < queue.size(); i++)
- {
- Cullable* c = queue[i];
+
+ for (auto& c : queue)
delete c;
- }
+
if (!list.empty())
{
ServerInstance->Logs.Debug("CULLLIST", "WARNING: Objects added to cull list in a destructor");
@@ -120,9 +119,7 @@ void CullList::Apply()
void ActionList::Run()
{
- for(unsigned int i=0; i < list.size(); i++)
- {
- list[i]->Call();
- }
+ for (auto& action : list)
+ action->Call();
list.clear();
}