Loading logd/LogWhiteBlackList.cpp +11 −17 Original line number Original line Diff line number Diff line Loading @@ -50,18 +50,14 @@ void Prune::format(char **strp) { } } PruneList::PruneList() : mWorstUidEnabled(true) { PruneList::PruneList() : mWorstUidEnabled(true) { mNaughty.clear(); mNice.clear(); } } PruneList::~PruneList() { PruneList::~PruneList() { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end();) { for (it = mNice.begin(); it != mNice.end();) { delete (*it); it = mNice.erase(it); it = mNice.erase(it); } } for (it = mNaughty.begin(); it != mNaughty.end();) { for (it = mNaughty.begin(); it != mNaughty.end();) { delete (*it); it = mNaughty.erase(it); it = mNaughty.erase(it); } } } } Loading @@ -70,11 +66,9 @@ int PruneList::init(char *str) { mWorstUidEnabled = true; mWorstUidEnabled = true; PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end();) { for (it = mNice.begin(); it != mNice.end();) { delete (*it); it = mNice.erase(it); it = mNice.erase(it); } } for (it = mNaughty.begin(); it != mNaughty.end();) { for (it = mNaughty.begin(); it != mNaughty.end();) { delete (*it); it = mNaughty.erase(it); it = mNaughty.erase(it); } } Loading Loading @@ -142,28 +136,28 @@ int PruneList::init(char *str) { // insert sequentially into list // insert sequentially into list PruneCollection::iterator it = list->begin(); PruneCollection::iterator it = list->begin(); while (it != list->end()) { while (it != list->end()) { Prune *p = *it; Prune &p = *it; int m = uid - p->mUid; int m = uid - p.mUid; if (m == 0) { if (m == 0) { if (p->mPid == p->pid_all) { if (p.mPid == p.pid_all) { break; break; } } if ((pid == p->pid_all) && (p->mPid != p->pid_all)) { if ((pid == p.pid_all) && (p.mPid != p.pid_all)) { it = list->erase(it); it = list->erase(it); continue; continue; } } m = pid - p->mPid; m = pid - p.mPid; } } if (m <= 0) { if (m <= 0) { if (m < 0) { if (m < 0) { list->insert(it, new Prune(uid,pid)); list->insert(it, Prune(uid,pid)); } } break; break; } } ++it; ++it; } } if (it == list->end()) { if (it == list->end()) { list->push_back(new Prune(uid,pid)); list->push_back(Prune(uid,pid)); } } if (!*str) { if (!*str) { break; break; Loading Loading @@ -193,7 +187,7 @@ void PruneList::format(char **strp) { for (it = mNice.begin(); it != mNice.end(); ++it) { for (it = mNice.begin(); it != mNice.end(); ++it) { char *a = NULL; char *a = NULL; (*it)->format(&a); (*it).format(&a); string.appendFormat(fmt, a); string.appendFormat(fmt, a); fmt = nice_format; fmt = nice_format; Loading @@ -205,7 +199,7 @@ void PruneList::format(char **strp) { fmt = naughty_format + (*fmt != ' '); fmt = naughty_format + (*fmt != ' '); for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { char *a = NULL; char *a = NULL; (*it)->format(&a); (*it).format(&a); string.appendFormat(fmt, a); string.appendFormat(fmt, a); fmt = naughty_format; fmt = naughty_format; Loading @@ -223,7 +217,7 @@ void PruneList::format(char **strp) { bool PruneList::naughty(LogBufferElement *element) { bool PruneList::naughty(LogBufferElement *element) { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { if (!(*it)->cmp(element)) { if (!(*it).cmp(element)) { return true; return true; } } } } Loading @@ -233,7 +227,7 @@ bool PruneList::naughty(LogBufferElement *element) { bool PruneList::nice(LogBufferElement *element) { bool PruneList::nice(LogBufferElement *element) { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end(); ++it) { for (it = mNice.begin(); it != mNice.end(); ++it) { if (!(*it)->cmp(element)) { if (!(*it).cmp(element)) { return true; return true; } } } } Loading logd/LogWhiteBlackList.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ #include <sys/types.h> #include <sys/types.h> #include <utils/List.h> #include <list> #include <LogBufferElement.h> #include <LogBufferElement.h> Loading Loading @@ -47,7 +47,7 @@ public: void format(char **strp); void format(char **strp); }; }; typedef android::List<Prune *> PruneCollection; typedef std::list<Prune> PruneCollection; class PruneList { class PruneList { PruneCollection mNaughty; PruneCollection mNaughty; Loading Loading
logd/LogWhiteBlackList.cpp +11 −17 Original line number Original line Diff line number Diff line Loading @@ -50,18 +50,14 @@ void Prune::format(char **strp) { } } PruneList::PruneList() : mWorstUidEnabled(true) { PruneList::PruneList() : mWorstUidEnabled(true) { mNaughty.clear(); mNice.clear(); } } PruneList::~PruneList() { PruneList::~PruneList() { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end();) { for (it = mNice.begin(); it != mNice.end();) { delete (*it); it = mNice.erase(it); it = mNice.erase(it); } } for (it = mNaughty.begin(); it != mNaughty.end();) { for (it = mNaughty.begin(); it != mNaughty.end();) { delete (*it); it = mNaughty.erase(it); it = mNaughty.erase(it); } } } } Loading @@ -70,11 +66,9 @@ int PruneList::init(char *str) { mWorstUidEnabled = true; mWorstUidEnabled = true; PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end();) { for (it = mNice.begin(); it != mNice.end();) { delete (*it); it = mNice.erase(it); it = mNice.erase(it); } } for (it = mNaughty.begin(); it != mNaughty.end();) { for (it = mNaughty.begin(); it != mNaughty.end();) { delete (*it); it = mNaughty.erase(it); it = mNaughty.erase(it); } } Loading Loading @@ -142,28 +136,28 @@ int PruneList::init(char *str) { // insert sequentially into list // insert sequentially into list PruneCollection::iterator it = list->begin(); PruneCollection::iterator it = list->begin(); while (it != list->end()) { while (it != list->end()) { Prune *p = *it; Prune &p = *it; int m = uid - p->mUid; int m = uid - p.mUid; if (m == 0) { if (m == 0) { if (p->mPid == p->pid_all) { if (p.mPid == p.pid_all) { break; break; } } if ((pid == p->pid_all) && (p->mPid != p->pid_all)) { if ((pid == p.pid_all) && (p.mPid != p.pid_all)) { it = list->erase(it); it = list->erase(it); continue; continue; } } m = pid - p->mPid; m = pid - p.mPid; } } if (m <= 0) { if (m <= 0) { if (m < 0) { if (m < 0) { list->insert(it, new Prune(uid,pid)); list->insert(it, Prune(uid,pid)); } } break; break; } } ++it; ++it; } } if (it == list->end()) { if (it == list->end()) { list->push_back(new Prune(uid,pid)); list->push_back(Prune(uid,pid)); } } if (!*str) { if (!*str) { break; break; Loading Loading @@ -193,7 +187,7 @@ void PruneList::format(char **strp) { for (it = mNice.begin(); it != mNice.end(); ++it) { for (it = mNice.begin(); it != mNice.end(); ++it) { char *a = NULL; char *a = NULL; (*it)->format(&a); (*it).format(&a); string.appendFormat(fmt, a); string.appendFormat(fmt, a); fmt = nice_format; fmt = nice_format; Loading @@ -205,7 +199,7 @@ void PruneList::format(char **strp) { fmt = naughty_format + (*fmt != ' '); fmt = naughty_format + (*fmt != ' '); for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { char *a = NULL; char *a = NULL; (*it)->format(&a); (*it).format(&a); string.appendFormat(fmt, a); string.appendFormat(fmt, a); fmt = naughty_format; fmt = naughty_format; Loading @@ -223,7 +217,7 @@ void PruneList::format(char **strp) { bool PruneList::naughty(LogBufferElement *element) { bool PruneList::naughty(LogBufferElement *element) { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { for (it = mNaughty.begin(); it != mNaughty.end(); ++it) { if (!(*it)->cmp(element)) { if (!(*it).cmp(element)) { return true; return true; } } } } Loading @@ -233,7 +227,7 @@ bool PruneList::naughty(LogBufferElement *element) { bool PruneList::nice(LogBufferElement *element) { bool PruneList::nice(LogBufferElement *element) { PruneCollection::iterator it; PruneCollection::iterator it; for (it = mNice.begin(); it != mNice.end(); ++it) { for (it = mNice.begin(); it != mNice.end(); ++it) { if (!(*it)->cmp(element)) { if (!(*it).cmp(element)) { return true; return true; } } } } Loading
logd/LogWhiteBlackList.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ #include <sys/types.h> #include <sys/types.h> #include <utils/List.h> #include <list> #include <LogBufferElement.h> #include <LogBufferElement.h> Loading Loading @@ -47,7 +47,7 @@ public: void format(char **strp); void format(char **strp); }; }; typedef android::List<Prune *> PruneCollection; typedef std::list<Prune> PruneCollection; class PruneList { class PruneList { PruneCollection mNaughty; PruneCollection mNaughty; Loading