Don't use auto&& in non-template code

Use explicit types instead.
This commit is contained in:
Markus Mäkelä 2018-08-01 14:11:15 +03:00
parent 4c7a5017bc
commit a252b45f18
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
10 changed files with 24 additions and 24 deletions

View File

@ -1155,7 +1155,7 @@ const MXS_MODULE* get_module(CONFIG_CONTEXT* obj, const char* param_name, const
return module ? get_module(module, module_type) : NULL;
}
std::pair<const MXS_MODULE_PARAM*, const MXS_MODULE*> get_module_details(CONFIG_CONTEXT* obj)
std::pair<const MXS_MODULE_PARAM*, const MXS_MODULE*> get_module_details(const CONFIG_CONTEXT* obj)
{
std::string type = config_get_string(obj->parameters, CN_TYPE);
@ -1190,7 +1190,7 @@ std::pair<const MXS_MODULE_PARAM*, const MXS_MODULE*> get_module_details(CONFIG_
}
CONFIG_CONTEXT* name_to_object(const std::vector<CONFIG_CONTEXT*>& objects,
CONFIG_CONTEXT* obj, std::string name)
const CONFIG_CONTEXT* obj, std::string name)
{
CONFIG_CONTEXT* rval = nullptr;
@ -1220,7 +1220,7 @@ CONFIG_CONTEXT* name_to_object(const std::vector<CONFIG_CONTEXT*>& objects,
}
std::unordered_set<CONFIG_CONTEXT*> get_dependencies(const std::vector<CONFIG_CONTEXT*>& objects,
CONFIG_CONTEXT* obj)
const CONFIG_CONTEXT* obj)
{
std::unordered_set<CONFIG_CONTEXT*> rval;
const MXS_MODULE_PARAM* params;
@ -1229,7 +1229,7 @@ std::unordered_set<CONFIG_CONTEXT*> get_dependencies(const std::vector<CONFIG_CO
// Astyle really hates this style. Could be worked around with --keep-one-line-blocks
// but it would keep all one line blocks intact.
for (auto&& p :
for (const auto& p :
{
params, module->parameters
})
@ -1407,7 +1407,7 @@ bool resolve_dependencies(std::vector<CONFIG_CONTEXT*>& objects)
int errors = 0;
std::unordered_map<CONFIG_CONTEXT*, std::unordered_set < CONFIG_CONTEXT*>> g;
for (auto&& obj : objects)
for (const auto& obj : objects)
{
auto deps = get_dependencies(objects, obj);
@ -1426,7 +1426,7 @@ bool resolve_dependencies(std::vector<CONFIG_CONTEXT*>& objects)
{
std::vector<CONFIG_CONTEXT*> result;
for (auto&& group : get_graph_cycles<CONFIG_CONTEXT*>(g))
for (const auto& group : get_graph_cycles<CONFIG_CONTEXT*>(g))
{
if (group.size() > 1)
{
@ -3386,7 +3386,7 @@ int create_new_service(CONFIG_CONTEXT *obj)
{
int error_count = 0;
for (auto&& a : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
for (auto& a : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
{
fix_object_name(a);
@ -3514,7 +3514,7 @@ int create_new_monitor(CONFIG_CONTEXT *obj, std::set<std::string>& monitored_ser
bool err = false;
// TODO: Use server list parameter type for this
for (auto&& s : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
for (auto& s : mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
{
fix_object_name(s);
SERVER* server = server_find_by_unique_name(s.c_str());
@ -4555,7 +4555,7 @@ namespace maxscale
ParamList::ParamList(std::initializer_list<std::pair<const char*, const char*>> list,
const MXS_MODULE_PARAM* module_params)
{
for (auto&& a : list)
for (const auto& a : list)
{
config_add_param(&m_ctx, a.first, a.second);
}

View File

@ -1810,7 +1810,7 @@ static bool validate_object_json(json_t* json, std::vector<std::string> paths,
}
else
{
for (auto&& a: paths)
for (const auto& a: paths)
{
if (!(value = mxs_json_pointer(json, a.c_str())))
{
@ -1822,7 +1822,7 @@ static bool validate_object_json(json_t* json, std::vector<std::string> paths,
}
}
for (auto&& a: relationships)
for (const auto& a: relationships)
{
StringSet relations;
if (extract_relations(json, relations, a.first, a.second))

View File

@ -142,7 +142,7 @@ MXS_MONITOR* monitor_create(const char *name, const char *module, MXS_CONFIG_PAR
mon->disk_space_check_interval = config_get_integer(params, CN_DISK_SPACE_CHECK_INTERVAL);
spinlock_init(&mon->lock);
for (auto&& s: mxs::strtok(config_get_string(params, CN_SERVERS), ","))
for (auto& s: mxs::strtok(config_get_string(params, CN_SERVERS), ","))
{
fix_object_name(s);
monitor_add_server(mon, server_find_by_unique_name(s.c_str()));

View File

@ -161,7 +161,7 @@ static int mysql_send_row(DCB *dcb, const std::vector<std::string>& row, int seq
*ptr++ = (len >> 16) & 0xff;
*ptr++ = seqno;
for (auto&& a : row)
for (const auto& a : row)
{
*ptr++ = a.length();
memcpy(ptr, a.c_str(), a.length());
@ -193,14 +193,14 @@ void ResultSet::write(DCB* dcb)
uint8_t seqno = 2; // The second packet after field count
for (auto&& c : m_columns)
for (const auto& c : m_columns)
{
mysql_send_columndef(dcb, c, seqno++);
}
mysql_send_eof(dcb, seqno++);
for (auto&& r : m_rows)
for (const auto& r : m_rows)
{
mysql_send_row(dcb, r, seqno++);
}

View File

@ -1237,7 +1237,7 @@ bool service_set_filters(Service* service, const char* filters)
std::vector<MXS_FILTER_DEF*> flist;
uint64_t capabilities = 0;
for (auto&& f: mxs::strtok(filters, "|"))
for (auto& f: mxs::strtok(filters, "|"))
{
fix_object_name(f);

View File

@ -76,9 +76,9 @@ void Avro::read_source_service_options(SERVICE* source)
}
}
for (auto&& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
for (const auto& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
{
auto&& kv = mxs::strtok(opt, "=");
auto kv = mxs::strtok(opt, "=");
if (kv[0] == "binlogdir")
{

View File

@ -172,7 +172,7 @@ static bool configureInstance(MXS_ROUTER* instance, MXS_CONFIG_PARAMETER* params
uint64_t bitvalue = 0;
bool ok = true;
for (auto&& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
for (const auto& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
{
if (!strcasecmp(opt.c_str(), "master"))
{

View File

@ -323,7 +323,7 @@ static void log_router_options_not_supported(SERVICE* service, MXS_CONFIG_PARAME
{
std::stringstream ss;
for (auto&& a: mxs::strtok(p->value, ", \t"))
for (const auto& a: mxs::strtok(p->value, ", \t"))
{
ss << a << "\n";
}

View File

@ -33,7 +33,7 @@ Config::Config(MXS_CONFIG_PARAMETER* conf):
// TODO: Don't process this in the router
if (MXS_CONFIG_PARAMETER* p = config_get_param(conf, "ignore_databases"))
{
for (auto&& a: mxs::strtok(p->value, ", \t"))
for (const auto& a: mxs::strtok(p->value, ", \t"))
{
ignored_dbs.insert(a);
}

View File

@ -895,7 +895,7 @@ bool SchemaRouterSession::send_shards()
ServerMap pContent;
m_shard.get_content(pContent);
for (auto&& a : pContent)
for (const auto& a : pContent)
{
set->add_row({a.first, a.second->name});
}
@ -1559,7 +1559,7 @@ bool SchemaRouterSession::send_databases()
std::unique_ptr<ResultSet> set = ResultSet::create({"Table"});
for (auto&& a : list)
for (const auto& a : list)
{
set->add_row({a});
}
@ -1613,7 +1613,7 @@ bool SchemaRouterSession::send_tables(GWBUF* pPacket)
{
std::unique_ptr<ResultSet> set = ResultSet::create({"Table"});
for (auto&& a : list)
for (const auto& a : list)
{
set->add_row({a});
}