diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index c9334a657e..e88de49277 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -132,8 +132,8 @@ db::commitlog::descriptor::descriptor(std::pair p) : descriptor(p.first, p.second) { } -db::commitlog::descriptor::descriptor(sstring filename) - : descriptor([filename]() { +db::commitlog::descriptor::descriptor(const sstring& filename) + : descriptor([&filename] () { std::smatch m; // match both legacy and new version of commitlogs Ex: CommitLog-12345.log and CommitLog-4-12345.log. std::regex rx("(?:.*/)?" + FILENAME_PREFIX + "((\\d+)(" + SEPARATOR + "\\d+)?)" + FILENAME_EXTENSION); diff --git a/db/commitlog/commitlog.hh b/db/commitlog/commitlog.hh index d02c60bf1e..c7946210ba 100644 --- a/db/commitlog/commitlog.hh +++ b/db/commitlog/commitlog.hh @@ -139,7 +139,7 @@ public: descriptor(const descriptor&) = default; descriptor(segment_id_type i, uint32_t v = 1); descriptor(replay_position p); - descriptor(sstring filename); + descriptor(const sstring& filename); sstring filename() const; operator replay_position() const;