Let lock_guard deduce its template argument
No functional change, this is a cleanup.
With C++17, it's no longer necessary to specify the teplate argument
when it can be deduced from the types of constructor arguments. This
allows de-cluttering our locking statements.
To avoid typos, this patch was mechanically generated:
perl -p -i -e 's/std::lock_guard<std::mutex>/std::lock_guard/g' \
$(find . -name '*.cpp' -o -name '*.h')
Change-Id: Ibb15d9a6c5b1c861d81353e47d25474eb1d4c2df
diff --git a/server/dns/DnsTlsSessionCache.cpp b/server/dns/DnsTlsSessionCache.cpp
index 880b773..58e36b5 100644
--- a/server/dns/DnsTlsSessionCache.cpp
+++ b/server/dns/DnsTlsSessionCache.cpp
@@ -54,7 +54,7 @@
}
void DnsTlsSessionCache::recordSession(SSL_SESSION* session) {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
mSessions.emplace_front(session);
if (mSessions.size() > kMaxSize) {
ALOGV("Too many sessions; trimming");
@@ -63,7 +63,7 @@
}
bssl::UniquePtr<SSL_SESSION> DnsTlsSessionCache::getSession() {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
if (mSessions.size() == 0) {
ALOGV("No known sessions");
return nullptr;