diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-13 13:14:27 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-16 17:27:29 +0200 |
commit | 223f67c2cbf4648c3aaa907ec0edf98e53b574e9 (patch) | |
tree | 7dd1e9aa2dd8a2470984a65d841e222b2226fa59 /src/other_tools/just_mr/launch.cpp | |
parent | febe0937cf4394bc0f908e13fd0b6ab63b2c29c2 (diff) | |
download | justbuild-223f67c2cbf4648c3aaa907ec0edf98e53b574e9.tar.gz |
Avoid unnecessary work in accessing container entries
- in sequence containers, use operator[] instead of .at() when
accessing indices guaranteed to be in bound;
- in associative containers, prefer .find() and reusing the
returned const iterator to using .contains() and .at(); while
there, make any so obtained iterators const if they are read-only.
Diffstat (limited to 'src/other_tools/just_mr/launch.cpp')
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 0a061031..c085f5be 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -93,8 +93,9 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, std::optional<LockFile> lock{}; if (subcommand and kKnownJustSubcommands.contains(*subcommand)) { + auto const& flags = kKnownJustSubcommands.at(*subcommand); // Read the config file if needed - if (kKnownJustSubcommands.at(*subcommand).config) { + if (flags.config) { auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config); if (not repo_lock) { @@ -128,15 +129,14 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, return kExitSetupError; } } - use_build_root = kKnownJustSubcommands.at(*subcommand).build_root; - use_launcher = kKnownJustSubcommands.at(*subcommand).launch; - supports_defines = kKnownJustSubcommands.at(*subcommand).defines; - supports_remote = kKnownJustSubcommands.at(*subcommand).remote; - supports_remote_properties = - kKnownJustSubcommands.at(*subcommand).remote_props; - supports_serve = kKnownJustSubcommands.at(*subcommand).serve; - supports_dispatch = kKnownJustSubcommands.at(*subcommand).dispatch; - does_build = kKnownJustSubcommands.at(*subcommand).does_build; + use_build_root = flags.build_root; + use_launcher = flags.launch; + supports_defines = flags.defines; + supports_remote = flags.remote; + supports_remote_properties = flags.remote_props; + supports_serve = flags.serve; + supports_dispatch = flags.dispatch; + does_build = flags.does_build; } // build just command std::vector<std::string> cmd = {common_args.just_path->string()}; |