diff options
author | Bernie Innocenti <codewiz@google.com> | 2018-08-10 15:17:16 +0900 |
---|---|---|
committer | Bernie Innocenti <codewiz@google.com> | 2018-08-10 16:21:24 +0900 |
commit | abf8a346f81f6e16a543892ba9ece6a4750ede9f (patch) | |
tree | ae063a7869402755bc894c154204ba970253b914 /server/RouteController.cpp | |
parent | 9e81f67e0d29332fd8da26929bad22ecd712e61f (diff) | |
download | netd-abf8a346f81f6e16a543892ba9ece6a4750ede9f.tar.gz |
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
Diffstat (limited to 'server/RouteController.cpp')
-rw-r--r-- | server/RouteController.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/RouteController.cpp b/server/RouteController.cpp index 16947afa..6774fd5d 100644 --- a/server/RouteController.cpp +++ b/server/RouteController.cpp @@ -155,7 +155,7 @@ uint32_t RouteController::getRouteTableForInterfaceLocked(const char* interface) } uint32_t RouteController::getIfIndex(const char* interface) { - std::lock_guard<std::mutex> lock(sInterfaceToTableLock); + std::lock_guard lock(sInterfaceToTableLock); auto iter = sInterfaceToTable.find(interface); if (iter == sInterfaceToTable.end()) { @@ -167,7 +167,7 @@ uint32_t RouteController::getIfIndex(const char* interface) { } uint32_t RouteController::getRouteTableForInterface(const char* interface) { - std::lock_guard<std::mutex> lock(sInterfaceToTableLock); + std::lock_guard lock(sInterfaceToTableLock); return getRouteTableForInterfaceLocked(interface); } @@ -191,7 +191,7 @@ void RouteController::updateTableNamesFile() { addTableName(ROUTE_TABLE_LEGACY_NETWORK, ROUTE_TABLE_NAME_LEGACY_NETWORK, &contents); addTableName(ROUTE_TABLE_LEGACY_SYSTEM, ROUTE_TABLE_NAME_LEGACY_SYSTEM, &contents); - std::lock_guard<std::mutex> lock(sInterfaceToTableLock); + std::lock_guard lock(sInterfaceToTableLock); for (const auto& entry : sInterfaceToTable) { addTableName(entry.second, entry.first, &contents); } @@ -927,7 +927,7 @@ WARN_UNUSED_RESULT int RouteController::flushRoutes(uint32_t table) { // Returns 0 on success or negative errno on failure. WARN_UNUSED_RESULT int RouteController::flushRoutes(const char* interface) { - std::lock_guard<std::mutex> lock(sInterfaceToTableLock); + std::lock_guard lock(sInterfaceToTableLock); uint32_t table = getRouteTableForInterfaceLocked(interface); if (table == RT_TABLE_UNSPEC) { |