service/client_state.cc: remove redundant copying

db::schema_tables::all_table_names() returns std::vector<sstring>.
Usage of range-for loop without reference results in copying each
of the elements of the traversed container. Such copying is redundant.

This change introduces usage of const reference to avoid copying.

Signed-off-by: Patryk Wrobel <patryk.wrobel@scylladb.com>

Closes scylladb/scylladb#16983
This commit is contained in:
Patryk Wrobel
2024-01-25 14:31:05 +01:00
committed by Avi Kivity
parent 543ad0987a
commit a858daf038

View File

@@ -151,7 +151,7 @@ future<> service::client_state::has_access(const sstring& ks, auth::command_desc
for (auto cf : { db::system_keyspace::LOCAL, db::system_keyspace::PEERS }) {
tmp.insert(auth::make_data_resource(db::system_keyspace::NAME, cf));
}
for (auto cf : db::schema_tables::all_table_names(db::schema_features::full())) {
for (const auto& cf : db::schema_tables::all_table_names(db::schema_features::full())) {
tmp.insert(auth::make_data_resource(db::schema_tables::NAME, cf));
}
return tmp;