]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/sensors.cpp
Prevent memory leak in smux plugin
[stg.git] / projects / stargazer / plugins / other / smux / sensors.cpp
index 48809032d7b9dcc35c30b966af98d59359b6d69d..6018566c72d358efeac54bda5246d797bb6eb06b 100644 (file)
@@ -1,4 +1,4 @@
-#include "asn1/INTEGER.h"
+#include "stg/INTEGER.h"
 
 #include "stg/user.h"
 
 
 #include "stg/user.h"
 
@@ -23,3 +23,26 @@ users.CloseSearch(handle);
 ValueToOS(count, objectSyntax);
 return true;
 }
 ValueToOS(count, objectSyntax);
 return true;
 }
+
+#ifdef DEBUG
+std::string UsersSensor::ToString() const
+{
+int handle = users.OpenSearch();
+if (!handle)
+    return "";
+
+USER_PTR user;
+size_t count = 0;
+while (!users.SearchNext(handle, &user))
+    {
+    if (UserPredicate(user))
+        ++count;
+    }
+
+users.CloseSearch(handle);
+
+std::string res;
+x2str(count, res);
+return res;
+}
+#endif