From e8138bb26b9b4bd8096e953eabe6f68ad92780e8 Mon Sep 17 00:00:00 2001 From: Unnamed Date: Fri, 22 Feb 2019 17:28:32 +0000 Subject: [PATCH] hack.cpp: optimize hack::ExecuteCommand a little Pass reference to std::string instead of std::string copy --- include/hack.hpp | 2 +- src/hack.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hack.hpp b/include/hack.hpp index e778cb11..31993cb6 100644 --- a/include/hack.hpp +++ b/include/hack.hpp @@ -23,7 +23,7 @@ namespace hack extern std::mutex command_stack_mutex; std::stack &command_stack(); -void ExecuteCommand(const std::string command); +void ExecuteCommand(const std::string &command); extern bool game_shutdown; extern bool shutdown; diff --git a/src/hack.cpp b/src/hack.cpp index da0a09b0..b192a912 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -94,7 +94,7 @@ std::stack &hack::command_stack() return stack; } -void hack::ExecuteCommand(const std::string command) +void hack::ExecuteCommand(const std::string &command) { std::lock_guard guard(hack::command_stack_mutex); hack::command_stack().push(command);