Commit 99b6bdec authored by Ben's avatar Ben

Move the UserMap directly into ProcInfo::lookup_user(...).

Less code for the same thing.
parent 6eb10b87
......@@ -134,10 +134,6 @@ class ProcInfo
/* undefined */ ProcInfo& operator=(const ProcInfo&);
/* undefined */ ProcInfo(const ProcInfo&);
typedef std::map<guint, std::string> UserMap;
/* cached username */
static UserMap users;
public:
// TODO: use a set instead
......
......@@ -63,7 +63,6 @@
#include <gdk/gdkx.h>
#endif
ProcInfo::UserMap ProcInfo::users;
ProcInfo::List ProcInfo::all;
std::map<pid_t, guint64> ProcInfo::cpu_times;
......@@ -651,9 +650,8 @@ get_process_name (ProcInfo *info,
std::string
ProcInfo::lookup_user(guint uid)
{
typedef std::pair<ProcInfo::UserMap::iterator, bool> Pair;
ProcInfo::UserMap::value_type hint(uid, "");
Pair p(ProcInfo::users.insert(hint));
static std::map<guint, std::string> users;
auto p = users.insert({uid, ""});
// procman_debug("User lookup for uid %u: %s", uid, (p.second ? "MISS" : "HIT"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment