Make users diagnostic deterministic

The output from Users::diagnostic is now ordered by first inserting the
usernames into a std::set.
This commit is contained in:
Markus Mäkelä 2018-09-08 18:27:44 +03:00
parent c81173e320
commit 8c03b626c4
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -15,6 +15,7 @@
#include <new>
#include <unordered_map>
#include <set>
#include <string>
#include <algorithm>
@ -160,10 +161,16 @@ public:
if (m_data.size())
{
const char* sep = "";
std::set<std::string> users;
for (UserMap::const_iterator it = m_data.begin(); it != m_data.end(); it++)
{
dcb_printf(dcb, "%s%s", sep, it->first.c_str());
users.insert(it->first);
}
for (const auto& a : users)
{
dcb_printf(dcb, "%s%s", sep, a.c_str());
sep = ", ";
}
}