From dc1d7fa5577f950cc5d922c92d0594dcc41f9936 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 27 Sep 2021 14:45:32 +0300 Subject: Fix worker not to perform unnecessary string copy --- bbot/worker/worker.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bbot') 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 #include -#include // strchr() +#include // strchr(), strncmp() #include #include #include // 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; -- cgit v1.1