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/DnsTlsDispatcher.cpp b/server/dns/DnsTlsDispatcher.cpp
index 95fbb9a..c336f54 100644
--- a/server/dns/DnsTlsDispatcher.cpp
+++ b/server/dns/DnsTlsDispatcher.cpp
@@ -44,7 +44,7 @@
// Pull out any servers for which we might have existing connections and
// place them at the from the list of servers to try.
{
- std::lock_guard<std::mutex> guard(sLock);
+ std::lock_guard guard(sLock);
for (const auto& tlsServer : tlsServers) {
const Key key = std::make_pair(mark, tlsServer);
@@ -113,7 +113,7 @@
const Key key = std::make_pair(mark, server);
Transport* xport;
{
- std::lock_guard<std::mutex> guard(sLock);
+ std::lock_guard guard(sLock);
auto it = mStore.find(key);
if (it == mStore.end()) {
xport = new Transport(server, mark, mFactory.get());
@@ -144,7 +144,7 @@
auto now = std::chrono::steady_clock::now();
{
- std::lock_guard<std::mutex> guard(sLock);
+ std::lock_guard guard(sLock);
--xport->useCount;
xport->lastUsed = now;
cleanup(now);