From c03e72cc1c155ff668df8df1caec363b07347d0d Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 18 Feb 2014 11:23:53 -0800 Subject: [PATCH] logd: Adjust to match defacto coding style (cherry picked from commit c46f77bd2ad01f3a695416c4cf22d6a9738bb7b8) Change-Id: I80685cdc7116e10c5a5a77abe856fd96804f9117 --- logd/FlushCommand.cpp | 4 ++-- logd/LogBuffer.cpp | 5 +++-- logd/LogCommand.cpp | 4 ++-- logd/LogTimes.cpp | 2 +- logd/LogTimes.h | 9 +++------ 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/logd/FlushCommand.cpp b/logd/FlushCommand.cpp index b848fd05a..f6f8cb804 100644 --- a/logd/FlushCommand.cpp +++ b/logd/FlushCommand.cpp @@ -63,7 +63,7 @@ void FlushCommand::runSocketCommand(SocketClient *client) { } if (it == times.end()) { - /* Create LogTimeEntry in notifyNewLog() ? */ + // Create LogTimeEntry in notifyNewLog() ? if (mTail == (unsigned long) -1) { LogTimeEntry::unlock(); return; @@ -74,7 +74,7 @@ void FlushCommand::runSocketCommand(SocketClient *client) { client->incRef(); - /* release client and entry reference counts once done */ + // release client and entry reference counts once done entry->startReader_Locked(); LogTimeEntry::unlock(); } diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index 64d5cc228..7340a36d8 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -52,11 +52,12 @@ void LogBuffer::log(log_id_t log_id, struct timespec realtime, LogBufferElementCollection::iterator it = mLogElements.end(); LogBufferElementCollection::iterator last = it; while (--it != mLogElements.begin()) { - if ((*it)->getRealTime() <= elem->getRealTime()) { + if ((*it)->getRealTime() <= realtime) { break; } last = it; } + if (last == mLogElements.end()) { mLogElements.push_back(elem); } else { @@ -83,7 +84,7 @@ void LogBuffer::log(log_id_t log_id, struct timespec realtime, } if (end_always - || (end_set && (end >= (*last)->getMonotonicTime()))) { + || (end_set && (end >= (*last)->getMonotonicTime()))) { mLogElements.push_back(elem); } else { mLogElements.insert(last,elem); diff --git a/logd/LogCommand.cpp b/logd/LogCommand.cpp index ec8365aa1..6ccc93e89 100644 --- a/logd/LogCommand.cpp +++ b/logd/LogCommand.cpp @@ -16,6 +16,6 @@ #include "LogCommand.h" -LogCommand::LogCommand(const char *cmd) : - FrameworkCommand(cmd) { +LogCommand::LogCommand(const char *cmd) + : FrameworkCommand(cmd) { } diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp index d6d4e9331..67cc65ecf 100644 --- a/logd/LogTimes.cpp +++ b/logd/LogTimes.cpp @@ -160,7 +160,7 @@ bool LogTimeEntry::FilterFirstPass(const LogBufferElement *element, void *obj) { } if ((!me->mPid || (me->mPid == element->getPid())) - && (me->mLogMask & (1 << element->getLogId()))) { + && (me->mLogMask & (1 << element->getLogId()))) { ++me->mCount; } diff --git a/logd/LogTimes.h b/logd/LogTimes.h index ac52db23d..cb6f56663 100644 --- a/logd/LogTimes.h +++ b/logd/LogTimes.h @@ -59,16 +59,14 @@ public: void startReader_Locked(void); - bool runningReader_Locked(void) const - { + bool runningReader_Locked(void) const { return threadRunning || mRelease || mError || mNonBlock; } void triggerReader_Locked(void) { threadTriggered = true; } void triggerSkip_Locked(unsigned int skip) { skipAhead = skip; } // Called after LogTimeEntry removed from list, lock implicitly held - void release_Locked(void) - { + void release_Locked(void) { mRelease = true; if (mRefCount || threadRunning) { return; @@ -89,8 +87,7 @@ public: bool owned_Locked(void) const { return mRefCount != 0; } - void decRef_Locked(void) - { + void decRef_Locked(void) { if ((mRefCount && --mRefCount) || !mRelease || threadRunning) { return; }