diff options
author | Maxim Pimenov <m@maps.me> | 2018-09-18 19:18:26 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2018-09-19 13:39:37 +0300 |
commit | 253168ebefc38779fb5e39a24dca07c1b991ca73 (patch) | |
tree | b6d049f09e22fcccd5220d5909a5000e307f84c7 /search | |
parent | bf2efe31fe88d740abf22edcb83071a78eba3296 (diff) |
[base] Removed the MY_ prefix from the scope guard.
Diffstat (limited to 'search')
-rw-r--r-- | search/engine.cpp | 2 | ||||
-rw-r--r-- | search/geocoder.cpp | 30 | ||||
-rw-r--r-- | search/search_integration_tests/processor_test.cpp | 2 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/edits.hpp | 8 |
4 files changed, 19 insertions, 23 deletions
diff --git a/search/engine.cpp b/search/engine.cpp index 1ae71962f0..a8e0a2a9ae 100644 --- a/search/engine.cpp +++ b/search/engine.cpp @@ -250,7 +250,7 @@ void Engine::DoSearch(SearchParams const & params, shared_ptr<ProcessorHandle> h { processor.Reset(); handle->Attach(processor); - MY_SCOPE_GUARD(detach, [&handle] { handle->Detach(); }); + SCOPE_GUARD(detach, [&handle] { handle->Detach(); }); processor.Search(params); } diff --git a/search/geocoder.cpp b/search/geocoder.cpp index 9feea7e816..6c8cecc271 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -405,10 +405,9 @@ void Geocoder::GoEverywhere() // work fast for most cases (significantly less than 1 second). #if defined(DEBUG) base::Timer timer; - MY_SCOPE_GUARD(printDuration, [&timer]() - { - LOG(LINFO, ("Total geocoding time:", timer.ElapsedSeconds(), "seconds")); - }); + SCOPE_GUARD(printDuration, [&timer]() { + LOG(LINFO, ("Total geocoding time:", timer.ElapsedSeconds(), "seconds")); + }); #endif if (m_params.GetNumTokens() == 0) @@ -514,7 +513,7 @@ void Geocoder::GoImpl(vector<shared_ptr<MwmInfo>> & infos, bool inViewport) ASSERT(context, ()); m_context = move(context); - MY_SCOPE_GUARD(cleanup, [&]() { + SCOPE_GUARD(cleanup, [&]() { LOG(LDEBUG, (m_context->GetName(), "geocoding complete.")); m_matcher->OnQueryFinished(); m_matcher = nullptr; @@ -547,7 +546,7 @@ void Geocoder::GoImpl(vector<shared_ptr<MwmInfo>> & infos, bool inViewport) auto citiesFromWorld = m_cities; FillVillageLocalities(ctx); - MY_SCOPE_GUARD(remove_villages, [&]() { m_cities = citiesFromWorld; }); + SCOPE_GUARD(remove_villages, [&]() { m_cities = citiesFromWorld; }); bool const intersectsPivot = index < numIntersectingMaps; if (m_params.IsCategorialRequest()) @@ -862,7 +861,7 @@ void Geocoder::MatchRegions(BaseContext & ctx, Region::Type type) continue; ctx.m_regions.push_back(®ion); - MY_SCOPE_GUARD(cleanup, [&ctx]() { ctx.m_regions.pop_back(); }); + SCOPE_GUARD(cleanup, [&ctx]() { ctx.m_regions.pop_back(); }); ScopedMarkTokens mark(ctx.m_tokens, BaseContext::FromRegionType(type), tokenRange); @@ -906,7 +905,7 @@ void Geocoder::MatchCities(BaseContext & ctx) ScopedMarkTokens mark(ctx.m_tokens, BaseContext::TOKEN_TYPE_CITY, tokenRange); ctx.m_city = &city; - MY_SCOPE_GUARD(cleanup, [&ctx]() { ctx.m_city = nullptr; }); + SCOPE_GUARD(cleanup, [&ctx]() { ctx.m_city = nullptr; }); if (ctx.AllTokensUsed()) { @@ -940,10 +939,7 @@ void Geocoder::MatchAroundPivot(BaseContext & ctx) void Geocoder::LimitedSearch(BaseContext & ctx, FeaturesFilter const & filter) { m_filter = &filter; - MY_SCOPE_GUARD(resetFilter, [&]() - { - m_filter = nullptr; - }); + SCOPE_GUARD(resetFilter, [&]() { m_filter = nullptr; }); if (!ctx.m_streets) ctx.m_streets = m_streetsCache.Get(*m_context); @@ -983,7 +979,7 @@ void Geocoder::WithPostcodes(BaseContext & ctx, TFn && fn) TokenRange const tokenRange(startToken, endToken); auto postcodes = RetrievePostcodeFeatures(*m_context, TokenSlice(m_params, tokenRange)); - MY_SCOPE_GUARD(cleanup, [&]() { m_postcodes.Clear(); }); + SCOPE_GUARD(cleanup, [&]() { m_postcodes.Clear(); }); if (!postcodes.IsEmpty()) { @@ -1014,7 +1010,7 @@ void Geocoder::CreateStreetsLayerAndMatchLowerLayers(BaseContext & ctx, ASSERT(layers.empty(), ()); layers.emplace_back(); - MY_SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); + SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); auto & layer = layers.back(); InitLayer(Model::TYPE_STREET, prediction.m_tokenRange, layer); @@ -1091,7 +1087,7 @@ void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken) // Following code creates a fake layer with buildings and // intersects it with the streets layer. layers.emplace_back(); - MY_SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); + SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); auto & layer = layers.back(); InitLayer(Model::TYPE_BUILDING, m_postcodes.m_tokenRange, layer); @@ -1105,7 +1101,7 @@ void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken) } layers.emplace_back(); - MY_SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); + SCOPE_GUARD(cleanupGuard, bind(&vector<FeaturesLayer>::pop_back, &layers)); // Clusters of features by search type. Each cluster is a sorted // list of ids. @@ -1295,7 +1291,7 @@ void Geocoder::FindPaths(BaseContext & ctx) void Geocoder::TraceResult(Tracer & tracer, BaseContext const & ctx, MwmSet::MwmId const & mwmId, uint32_t ftId, Model::Type type, TokenRange const & tokenRange) { - MY_SCOPE_GUARD(emitParse, [&]() { tracer.EmitParse(ctx.m_tokens); }); + SCOPE_GUARD(emitParse, [&]() { tracer.EmitParse(ctx.m_tokens); }); if (type != Model::TYPE_POI && type != Model::TYPE_BUILDING) return; diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index ca7a7fbf2f..6d864d3ae9 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -1335,7 +1335,7 @@ UNIT_CLASS_TEST(ProcessorTest, PathsThroughLayers) FeaturesLayerPathFinder::MODE_BOTTOM_UP}) { FeaturesLayerPathFinder::SetModeForTesting(mode); - MY_SCOPE_GUARD(rollbackMode, [&] { + SCOPE_GUARD(rollbackMode, [&] { FeaturesLayerPathFinder::SetModeForTesting(FeaturesLayerPathFinder::MODE_AUTO); }); diff --git a/search/search_quality/assessment_tool/edits.hpp b/search/search_quality/assessment_tool/edits.hpp index 5c62b09dfb..df1793ed2e 100644 --- a/search/search_quality/assessment_tool/edits.hpp +++ b/search/search_quality/assessment_tool/edits.hpp @@ -120,10 +120,10 @@ private: template <typename Fn> std::result_of_t<Fn()> WithObserver(Update const & update, Fn && fn) { - MY_SCOPE_GUARD(obsCall, ([this, &update]() { - if (m_onUpdate) - m_onUpdate(update); - })); + SCOPE_GUARD(obsCall, ([this, &update]() { + if (m_onUpdate) + m_onUpdate(update); + })); return fn(); } |