diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-02 16:50:08 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-02 16:50:08 +0200 |
| commit | 0599d52d80beb85e50ffe1f56c8434376a8c08a2 (patch) | |
| tree | 9c27adbe6bbbcd79d0153c6167cd385f0ded98e3 /zenstore/gc.cpp | |
| parent | Refactor WriteChunk to not need callback (diff) | |
| download | zen-0599d52d80beb85e50ffe1f56c8434376a8c08a2.tar.xz zen-0599d52d80beb85e50ffe1f56c8434376a8c08a2.zip | |
simplify lambda captures
Diffstat (limited to 'zenstore/gc.cpp')
| -rw-r--r-- | zenstore/gc.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp index 21522e46a..4b50668d9 100644 --- a/zenstore/gc.cpp +++ b/zenstore/gc.cpp @@ -76,7 +76,7 @@ namespace { return MakeErrorCodeFromLastError(); } bool Keep = true; - auto _ = MakeGuard([FileHandle, &Keep, Path]() { + auto _ = MakeGuard([&]() { ::CloseHandle(FileHandle); if (!Keep) { @@ -105,7 +105,7 @@ namespace { } bool Keep = true; - auto _ = MakeGuard([Fd, &Keep, Path]() { + auto _ = MakeGuard([&]() { close(Fd); if (!Keep) { @@ -392,7 +392,7 @@ CasGc::CollectGarbage(GcContext& GcCtx) // First gather reference set { Stopwatch Timer; - const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("gathered references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); + const auto Guard = MakeGuard([&] { ZEN_INFO("gathered references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); for (GcContributor* Contributor : m_GcContribs) { Contributor->GatherReferences(GcCtx); @@ -433,7 +433,7 @@ CasGc::CollectGarbage(GcContext& GcCtx) { Stopwatch Timer; - const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("collected garbage in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); + const auto Guard = MakeGuard([&] { ZEN_INFO("collected garbage in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); for (GcStorage* Storage : m_GcStorage) { Storage->CollectGarbage(GcCtx); @@ -445,8 +445,7 @@ CasGc::CollectGarbage(GcContext& GcCtx) if (CidStore* CidStore = m_CidStore) { Stopwatch Timer; - const auto Guard = - MakeGuard([this, &Timer] { ZEN_INFO("clean up deleted content ids in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); + const auto Guard = MakeGuard([&] { ZEN_INFO("clean up deleted content ids in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); CidStore->RemoveCids(GcCtx.DeletedCas()); } } @@ -672,8 +671,7 @@ GcScheduler::SchedulerThread() NiceTimeSpanMs(uint64_t(std::chrono::duration_cast<std::chrono::milliseconds>(GcCtx.MaxCacheDuration()).count()))); { Stopwatch Timer; - const auto __ = - MakeGuard([this, &Timer] { ZEN_INFO("garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); + const auto __ = MakeGuard([&] { ZEN_INFO("garbage collection DONE after {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); m_CasGc.CollectGarbage(GcCtx); |