From 738447426896b1bdc24bf85532fa2452d462189e Mon Sep 17 00:00:00 2001 From: staticfox Date: Sun, 7 Aug 2016 12:36:20 -0400 Subject: SocketSpy: Move to unordered_set --- src/modules/socketspy/libkvisocketspy.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/modules/socketspy/libkvisocketspy.cpp') diff --git a/src/modules/socketspy/libkvisocketspy.cpp b/src/modules/socketspy/libkvisocketspy.cpp index 9ecaa2863..0ef6818be 100644 --- a/src/modules/socketspy/libkvisocketspy.cpp +++ b/src/modules/socketspy/libkvisocketspy.cpp @@ -29,8 +29,9 @@ #include "KviLocale.h" #include +#include -KviPointerList * g_pSocketSpyWindowList = nullptr; +std::unordered_set g_pSocketSpyWindowList; /* @doc: socketspy.open @@ -59,25 +60,20 @@ static bool socketspy_kvs_cmd_open(KviKvsModuleCommandCall * c) static bool socketspy_module_init(KviModule * m) { - g_pSocketSpyWindowList = new KviPointerList; - g_pSocketSpyWindowList->setAutoDelete(false); - KVSM_REGISTER_SIMPLE_COMMAND(m, "open", socketspy_kvs_cmd_open); return true; } static bool socketspy_module_cleanup(KviModule *) { - while(g_pSocketSpyWindowList->first()) - g_pSocketSpyWindowList->first()->die(); - delete g_pSocketSpyWindowList; - g_pSocketSpyWindowList = nullptr; + for(auto & s : g_pSocketSpyWindowList) + s->die(); return true; } static bool socketspy_module_can_unload(KviModule *) { - return (g_pSocketSpyWindowList->isEmpty()); + return (g_pSocketSpyWindowList.empty()); } KVIRC_MODULE( -- cgit v1.3.1-10-gc9f91