]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Move DeleteZero to stdalgo::delete_zero.
authorSadie Powell <sadie@witchery.services>
Sun, 19 Jan 2020 15:41:23 +0000 (15:41 +0000)
committerSadie Powell <sadie@witchery.services>
Sun, 19 Jan 2020 15:41:23 +0000 (15:41 +0000)
include/stdalgo.h
src/inspircd.cpp

index 683b2655bc9eb111bf9fb8c81160a3d3cc2cfbad..5786181323e998fc04be413573c3f076ebefeba5 100644 (file)
@@ -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
index 8cc1dd8787d0f38458d1bf4f038394ab416284a7..dea4b45755fcfa595b91fc2c5164f91c7ae83448 100644 (file)
@@ -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();
 }