diff options
| author | 2016-08-07 12:36:20 -0400 | |
|---|---|---|
| committer | 2016-08-07 23:12:47 -0400 | |
| commit | 738447426896b1bdc24bf85532fa2452d462189e (patch) | |
| tree | 388b61efaf7605dfb0680612bd5f2209f7f3f125 /src/modules/socketspy/libkvisocketspy.cpp | |
| parent | KviKvsAsyncOperation: Move to unordered_set (diff) | |
| download | KVIrc-738447426896b1bdc24bf85532fa2452d462189e.tar.gz KVIrc-738447426896b1bdc24bf85532fa2452d462189e.tar.bz2 KVIrc-738447426896b1bdc24bf85532fa2452d462189e.zip | |
SocketSpy: Move to unordered_set
Diffstat (limited to 'src/modules/socketspy/libkvisocketspy.cpp')
| -rw-r--r-- | src/modules/socketspy/libkvisocketspy.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
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 <QSplitter> +#include <unordered_set> -KviPointerList<SocketSpyWindow> * g_pSocketSpyWindowList = nullptr; +std::unordered_set<SocketSpyWindow *> 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<SocketSpyWindow>; - 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( |
