aboutsummaryrefslogtreecommitdiff
path: root/bbot/worker/worker.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-27 14:45:32 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-09-27 23:30:45 +0300
commitdc1d7fa5577f950cc5d922c92d0594dcc41f9936 (patch)
tree6e9957a0eb01b365de7d7bfac2257c3ae30e0ead /bbot/worker/worker.cxx
parentf7a85ac1c09588b27854cef732b9e7a5e7bf6764 (diff)
Fix worker not to perform unnecessary string copy
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r--bbot/worker/worker.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index 49248b1..2dcd955 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -9,7 +9,7 @@
#include <map>
#include <regex>
-#include <cstring> // strchr()
+#include <cstring> // strchr(), strncmp()
#include <sstream>
#include <iostream>
#include <algorithm> // find(), find_if(), remove_if()
@@ -1004,10 +1004,10 @@ build (size_t argc, const char* argv[])
size_t n (19);
auto space = [] (char c) {return c == ' ' || c == '\t';};
- for (const string& s:
+ for (const char* s:
reverse_iterate (step_args (config_args, step_id::bpkg_create)))
{
- if (s.compare (0, n, "config.install.root") == 0 &&
+ if (strncmp (s, "config.install.root", n) == 0 &&
(s[n] == '=' || space (s[n])))
{
while (space (s[n])) ++n; // Skip spaces.
@@ -1017,7 +1017,7 @@ build (size_t argc, const char* argv[])
// Note that the config.install.root variable value may
// potentially be quoted.
//
- install_root = dir_path (unquote (string (s, n, s.size () - n)));
+ install_root = dir_path (unquote (s + n));
break;
}
}
@@ -1409,7 +1409,7 @@ build (size_t argc, const char* argv[])
{
step_id s (step_id::bpkg_module_create);
- for (const string& m: step_args (modules, s))
+ for (const char* m: step_args (modules, s))
{
if (!mods.empty ())
mods += ' ';
@@ -2177,7 +2177,7 @@ build (size_t argc, const char* argv[])
string mods; // build2 create meta-operation parameters.
- for (const string& m: step_args (modules, s, f))
+ for (const char* m: step_args (modules, s, f))
{
mods += mods.empty () ? ", " : " ";
mods += m;