Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a89fbd

Browse files
committed
clang-tidy performance fix
1 parent 962867e commit 9a89fbd

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/pluginmanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Registration
129129
public:
130130
Registration(const string& name, Factory factory)
131131
{
132-
PluginRegistry::Instance().Register(name, factory);
132+
PluginRegistry::Instance().Register(name, std::move(factory));
133133
}
134134
};
135135

include/cli/cli.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ namespace cli
712712
bool found = globalScopeMenu->ScanCmds(strs, *this);
713713

714714
// root menu recursive cmds check
715-
if (!found) found = current->ScanCmds(std::move(strs), *this); // last use of strs
715+
if (!found) found = current->ScanCmds(strs, *this);
716716

717717
if (!found) // error msg if not found
718718
out << "wrong command: " << cmd << '\n';

include/cli/detail/genericasioremotecli.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ class CliTelnetSession : public InputDevice, public TelnetSession, public CliSes
444444
{
445445
public:
446446

447-
CliTelnetSession(Scheduler& _scheduler, asiolib::ip::tcp::socket _socket, Cli& _cli, std::function< void(std::ostream&)> _exitAction, std::size_t historySize ) :
447+
CliTelnetSession(Scheduler& _scheduler, asiolib::ip::tcp::socket _socket, Cli& _cli, const std::function< void(std::ostream&)>& _exitAction, std::size_t historySize ) :
448448
InputDevice(_scheduler),
449449
TelnetSession(std::move(_socket)),
450450
CliSession(_cli, TelnetSession::OutStream(), historySize),

test/test_cli.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace {
4040
string ExtractFirstPrompt(const stringstream& o)
4141
{
4242
auto content = o.str();
43-
std::size_t pos = content.find_first_of(">");
43+
std::size_t pos = content.find_first_of('>');
4444
return content.substr(0, pos);
4545
}
4646

@@ -49,7 +49,7 @@ string ExtractLastPrompt(const stringstream& o)
4949
auto content = o.str();
5050
std::size_t pos = content.find_last_of('\n');
5151
content = content.substr(pos+1);
52-
pos = content.find_last_of(">");
52+
pos = content.find_last_of('>');
5353
return content.substr(0, pos);
5454
}
5555

@@ -69,7 +69,7 @@ string ExtractContent(const stringstream& o)
6969
{
7070
auto content = o.str();
7171
// last line
72-
auto lastNL = content.find_last_of("\n");
72+
auto lastNL = content.find_last_of('\n');
7373
auto lastLine = content.substr(lastNL+1);
7474
content = content.substr(0, lastNL);
7575
auto pos = content.find(lastLine);

0 commit comments

Comments
 (0)