diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-23 17:18:42 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-23 18:29:08 +0100 |
commit | 0374b80dd407d7b35654a01e3c7526b749d3464e (patch) | |
tree | d0e62aece120c764ad557501e60398317c7dc77a /src/other_tools/git_operations | |
parent | 1de5a178bc804209eeeb512023de1ce4d77eef42 (diff) | |
download | justbuild-0374b80dd407d7b35654a01e3c7526b749d3464e.tar.gz |
Just-MR: Remove wrong pass-by-reference when wrapping loggers
Passing the logger by reference would require the caller to be
kept alive. Also, being a shared_ptr, the logger can be passed
by value at almost no cost.
Diffstat (limited to 'src/other_tools/git_operations')
-rw-r--r-- | src/other_tools/git_operations/git_operations.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp index 2b519691..bf6b29b3 100644 --- a/src/other_tools/git_operations/git_operations.cpp +++ b/src/other_tools/git_operations/git_operations.cpp @@ -34,7 +34,7 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params, } // setup wrapped logger auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)( fmt::format("While doing initial commit Git op:\n{}", msg), fatal); @@ -95,7 +95,7 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params, } // setup wrapped logger auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)(fmt::format("While doing keep tag Git op:\n{}", msg), fatal); }); @@ -129,7 +129,7 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params, } // setup wrapped logger auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)(fmt::format("While doing get HEAD id Git op:\n{}", msg), fatal); }); @@ -162,7 +162,7 @@ auto CriticalGitOps::GitGetBranchRefname( } // setup wrapped logger auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>( - [&logger](auto const& msg, bool fatal) { + [logger](auto const& msg, bool fatal) { (*logger)( fmt::format("While doing get branch refname Git op:\n{}", msg), fatal); |