summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-01-19 15:41:23 +0000
committerSadie Powell <sadie@witchery.services>2020-01-19 15:41:23 +0000
commit62483525bb81a62b72539a3bda9d1a9b425b482c (patch)
tree3980d86af08dbee99e8f7255b82ffd216eb9c1b6
parent5d1ff2971a988f4a0b683b286eb598e6cfdcb1ce (diff)
Move DeleteZero to stdalgo::delete_zero.
-rw-r--r--include/stdalgo.h11
-rw-r--r--src/inspircd.cpp15
2 files changed, 14 insertions, 12 deletions
diff --git a/include/stdalgo.h b/include/stdalgo.h
index 683b2655b..578618132 100644
--- a/include/stdalgo.h
+++ b/include/stdalgo.h
@@ -182,6 +182,17 @@ namespace stdalgo
std::for_each(cont.begin(), cont.end(), defaultdeleter<T>());
}
+ /** Deletes a object and zeroes the memory location that pointed to it.
+ * @param pr A reference to the pointer that contains the object to delete.
+ */
+ template<typename T>
+ void delete_zero(T*& pr)
+ {
+ T* p = pr;
+ pr = NULL;
+ delete p;
+ }
+
/**
* Remove an element from a container
* @param cont Container to remove the element from
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 8cc1dd878..dea4b4575 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -136,15 +136,6 @@ namespace
#endif
}
- // Deletes a pointer and then zeroes it.
- template<typename T>
- void DeleteZero(T*& pr)
- {
- T* p = pr;
- pr = NULL;
- delete p;
- }
-
// Drops to the unprivileged user/group specified in <security:runas{user,group}>.
void DropRoot()
{
@@ -423,9 +414,9 @@ void InspIRCd::Cleanup()
delete FakeClient->server;
FakeClient->cull();
}
- DeleteZero(this->FakeClient);
- DeleteZero(this->XLines);
- DeleteZero(this->Config);
+ stdalgo::delete_zero(this->FakeClient);
+ stdalgo::delete_zero(this->XLines);
+ stdalgo::delete_zero(this->Config);
SocketEngine::Deinit();
Logs->CloseLogs();
}