MXS-2304 Remove remaining uses of config_get_string() from module code
The function returns a pointer to an internal string and should not be used.
This commit is contained in:
@ -250,9 +250,9 @@ RegexHintFilter* RegexHintFilter::create(const char* name, MXS_CONFIG_PARAMETER*
|
||||
SourceHostVector source_addresses;
|
||||
StringVector source_hostnames;
|
||||
|
||||
const char* source = config_get_string(params, "source");
|
||||
std::string source = params->get_string("source");
|
||||
|
||||
if (*source)
|
||||
if (!source.empty())
|
||||
{
|
||||
set_source_addresses(source, source_addresses, source_hostnames);
|
||||
}
|
||||
|
@ -212,13 +212,13 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
|
||||
my_instance->user = params->get_c_str_copy("user");
|
||||
my_instance->log_trace = params->get_bool("log_trace");
|
||||
|
||||
const char* logfile = config_get_string(params, "log_file");
|
||||
std::string logfile = params->get_string("log_file");
|
||||
|
||||
if (*logfile)
|
||||
if (!logfile.empty())
|
||||
{
|
||||
if ((my_instance->logfile = fopen(logfile, "a")) == NULL)
|
||||
if ((my_instance->logfile = fopen(logfile.c_str(), "a")) == NULL)
|
||||
{
|
||||
MXS_ERROR("Failed to open file '%s'.", logfile);
|
||||
MXS_ERROR("Failed to open file '%s'.", logfile.c_str());
|
||||
free_instance(my_instance);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -65,21 +65,17 @@ Tee::Tee(SERVICE* service,
|
||||
Tee* Tee::create(const char* name, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
SERVICE* service = params->get_service("service");
|
||||
const char* source = config_get_string(params, "source");
|
||||
const char* user = config_get_string(params, "user");
|
||||
uint32_t cflags = params->get_enum("options", option_values);
|
||||
pcre2_code* match = config_get_compiled_regex(params, "match", cflags, NULL);
|
||||
pcre2_code* exclude = config_get_compiled_regex(params, "exclude", cflags, NULL);
|
||||
const char* match_str = config_get_string(params, "match");
|
||||
const char* exclude_str = config_get_string(params, "exclude");
|
||||
|
||||
Tee* my_instance = new(std::nothrow) Tee(service,
|
||||
source,
|
||||
user,
|
||||
params->get_string("source"),
|
||||
params->get_string("user"),
|
||||
match,
|
||||
match_str,
|
||||
params->get_string("match"),
|
||||
exclude,
|
||||
exclude_str);
|
||||
params->get_string("exclude"));
|
||||
|
||||
if (my_instance == NULL)
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ RWSplit* RWSplit::create(SERVICE* service, MXS_CONFIG_PARAMETER* params)
|
||||
|
||||
Config config(params);
|
||||
|
||||
if (!handle_max_slaves(config, config_get_string(params, "max_slave_connections")))
|
||||
if (!handle_max_slaves(config, params->get_string("max_slave_connections").c_str()))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -447,7 +447,7 @@ bool RWSplit::configure(MXS_CONFIG_PARAMETER* params)
|
||||
bool rval = false;
|
||||
Config cnf(params);
|
||||
|
||||
if (handle_max_slaves(cnf, config_get_string(params, "max_slave_connections")))
|
||||
if (handle_max_slaves(cnf, params->get_string("max_slave_connections").c_str()))
|
||||
{
|
||||
m_config.assign(cnf);
|
||||
rval = true;
|
||||
|
Reference in New Issue
Block a user