logd: switch to unordered_map from BasicHashtable
(charry pick from commit 511338dd575572d567c04d69eaea60627b6c3452)
BasicHashtable is relatively untested, move over to
a C++ template library that has more bake time.
Bug: 20419786
Bug: 21590652
Bug: 20500228
Change-Id: I926aaecdc8345eca75c08fdd561b0473504c5d95
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 90c49c0..48c2fe6 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -161,9 +161,8 @@
}
// report uid -> pid(s) -> pidToName if unique
- ssize_t index = -1;
- while ((index = pidTable.next(index)) != -1) {
- const PidEntry &entry = pidTable.entryAt(index);
+ for(pidTable_t::iterator it = pidTable.begin(); it != pidTable.end(); ++it) {
+ const PidEntry &entry = it->second;
if (entry.getUid() == uid) {
const char *n = entry.getName();
@@ -520,12 +519,12 @@
}
uid_t LogStatistics::pidToUid(pid_t pid) {
- return pidTable.entryAt(pidTable.add(pid)).getUid();
+ return pidTable.add(pid)->second.getUid();
}
// caller must free character string
char *LogStatistics::pidToName(pid_t pid) {
- const char *name = pidTable.entryAt(pidTable.add(pid)).getName();
+ const char *name = pidTable.add(pid)->second.getName();
if (!name) {
return NULL;
}