diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-01-31 21:03:57 -0800 |
---|---|---|
committer | Rosen Penev <rosenp@gmail.com> | 2020-02-01 19:49:17 -0800 |
commit | 40d04206482891d53fbf39911824f02a79ec99cc (patch) | |
tree | e2d2320580660c8342dbfeeb636bcf699fabe45b /src | |
parent | bc6eca2115d8d333eed61d23a01958926bbd7a9c (diff) |
[clang-tidy] convert several loops to const auto&
Found with performance-for-range-copy
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/input/InputPlugin.cxx | 2 | ||||
-rw-r--r-- | src/ls.cxx | 4 | ||||
-rw-r--r-- | src/storage/StorageState.cxx | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/input/InputPlugin.cxx b/src/input/InputPlugin.cxx index 547fd0dd7..4b0f61bfc 100644 --- a/src/input/InputPlugin.cxx +++ b/src/input/InputPlugin.cxx @@ -33,7 +33,7 @@ InputPlugin::SupportsUri(const char *uri) const noexcept if (StringStartsWithIgnoreCase(uri, *i)) return true; } else { - for (auto schema : protocols()) { + for (const auto& schema : protocols()) { if (StringStartsWithIgnoreCase(uri, schema.c_str())){ return true; } diff --git a/src/ls.cxx b/src/ls.cxx index 9e45e8b21..1b8e2ced2 100644 --- a/src/ls.cxx +++ b/src/ls.cxx @@ -39,7 +39,7 @@ void print_supported_uri_schemes_to_fp(FILE *fp) protocols.emplace(uri); }); - for (auto protocol : protocols) { + for (const auto& protocol : protocols) { fprintf(fp, " %s", protocol.c_str()); } fprintf(fp,"\n"); @@ -54,7 +54,7 @@ print_supported_uri_schemes(Response &r) protocols.emplace(uri); }); - for (auto protocol : protocols) { + for (const auto& protocol : protocols) { r.Format("handler: %s\n", protocol.c_str()); } } diff --git a/src/storage/StorageState.cxx b/src/storage/StorageState.cxx index b5fba35af..a93ed6f28 100644 --- a/src/storage/StorageState.cxx +++ b/src/storage/StorageState.cxx @@ -139,7 +139,7 @@ storage_state_get_hash(const Instance &instance) boost::crc_32_type result; - for (auto mount: mounts) { + for (const auto& mount : mounts) { result.process_bytes(mount.c_str(), mount.length()); } |