diff --git a/logd/ChattyLogBuffer.cpp b/logd/ChattyLogBuffer.cpp index 9a4529986..c6c9a7c37 100644 --- a/logd/ChattyLogBuffer.cpp +++ b/logd/ChattyLogBuffer.cpp @@ -31,7 +31,6 @@ #include #include -#include #include #include "LogUtils.h" diff --git a/logd/LogWhiteBlackList.cpp b/logd/LogWhiteBlackList.cpp index 9d762dca4..88a3bdc7c 100644 --- a/logd/LogWhiteBlackList.cpp +++ b/logd/LogWhiteBlackList.cpp @@ -16,13 +16,11 @@ #include +#include #include -#include #include "LogWhiteBlackList.h" -// White and Black list - Prune::Prune(uid_t uid, pid_t pid) : mUid(uid), mPid(pid) { } @@ -75,14 +73,12 @@ int PruneList::init(const char* str) { it = mNaughty.erase(it); } - static const char _default[] = "default"; // default here means take ro.logd.filter, persist.logd.filter then // internal default in that order. - if (str && !strcmp(str, _default)) { + if (str && !strcmp(str, "default")) { str = nullptr; } - static const char _disable[] = "disable"; - if (str && !strcmp(str, _disable)) { + if (str && !strcmp(str, "disable")) { str = ""; } @@ -91,22 +87,20 @@ int PruneList::init(const char* str) { if (str) { filter = str; } else { - char property[PROPERTY_VALUE_MAX]; - property_get("ro.logd.filter", property, _default); - filter = property; - property_get("persist.logd.filter", property, filter.c_str()); + filter = android::base::GetProperty("ro.logd.filter", "default"); + auto persist_filter = android::base::GetProperty("persist.logd.filter", "default"); // default here means take ro.logd.filter - if (strcmp(property, _default)) { - filter = property; + if (persist_filter != "default") { + filter = persist_filter; } } // default here means take internal default. - if (filter == _default) { + if (filter == "default") { // See README.property for description of filter format filter = "~! ~1000/!"; } - if (filter == _disable) { + if (filter == "disable") { filter = ""; } diff --git a/logd/LogWhiteBlackList.h b/logd/LogWhiteBlackList.h index 6e9893b6d..0e4e8371f 100644 --- a/logd/LogWhiteBlackList.h +++ b/logd/LogWhiteBlackList.h @@ -14,8 +14,7 @@ * limitations under the License. */ -#ifndef _LOGD_LOG_WHITE_BLACK_LIST_H__ -#define _LOGD_LOG_WHITE_BLACK_LIST_H__ +#pragma once #include @@ -24,8 +23,6 @@ #include "LogBufferElement.h" -// White and Blacklist - class Prune { friend class PruneList; @@ -84,5 +81,3 @@ class PruneList { std::string format(); }; - -#endif // _LOGD_LOG_WHITE_BLACK_LIST_H__ diff --git a/logd/main.cpp b/logd/main.cpp index dfbad31fa..1deca7261 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -38,7 +38,6 @@ #include #include -#include #include #include #include