MXS-2304 Use get_c_str_copy instead of config_copy_string()

Also uses get_string() in core-code when appropriate.
This commit is contained in:
Esa Korhonen
2019-02-04 12:13:12 +02:00
parent 692dd195ec
commit 4132c9bbbc
14 changed files with 67 additions and 73 deletions

View File

@ -375,7 +375,7 @@ bool CacheFilter::process_params(MXS_CONFIG_PARAMETER* ppParams, CACHE_CONFIG& c
error = true;
}
config.rules = config_copy_string(ppParams, "rules");
config.rules = ppParams->get_c_str_copy("rules");
const MXS_CONFIG_PARAMETER* pParam = config_get_param(ppParams, "storage_options");

View File

@ -175,8 +175,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
if ((my_instance = static_cast<DS_INSTANCE*>(MXS_CALLOC(1, sizeof(DS_INSTANCE)))) != NULL)
{
my_instance->source = config_copy_string(params, "source");
my_instance->user = config_copy_string(params, "user");
my_instance->source = params->get_c_str_copy("source");
my_instance->user = params->get_c_str_copy("user");
}
return (MXS_FILTER*) my_instance;

View File

@ -262,8 +262,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
return NULL;
}
my_instance->global_script = config_copy_string(params, "global_script");
my_instance->session_script = config_copy_string(params, "session_script");
my_instance->global_script = params->get_c_str_copy("global_script");
my_instance->session_script = params->get_c_str_copy("session_script");
my_instance->global_lua_state = nullptr;
if (my_instance->global_script)

View File

@ -595,10 +595,10 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
my_instance->exchange = MXS_STRDUP_A(config_get_string(params, "exchange"));
my_instance->key = MXS_STRDUP_A(config_get_string(params, "key"));
my_instance->exchange_type = MXS_STRDUP_A(config_get_string(params, "exchange_type"));
my_instance->queue = config_copy_string(params, "queue");
my_instance->ssl_client_cert = config_copy_string(params, "ssl_client_certificate");
my_instance->ssl_client_key = config_copy_string(params, "ssl_client_key");
my_instance->ssl_CA_cert = config_copy_string(params, "ssl_CA_cert");
my_instance->queue = params->get_c_str_copy("queue");
my_instance->ssl_client_cert = params->get_c_str_copy("ssl_client_certificate");
my_instance->ssl_client_key = params->get_c_str_copy("ssl_client_key");
my_instance->ssl_CA_cert = params->get_c_str_copy("ssl_CA_cert");
if (my_instance->trgtype & TRG_SOURCE)
{

View File

@ -208,8 +208,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
{
my_instance->match = MXS_STRDUP_A(config_get_string(params, "match"));
my_instance->replace = MXS_STRDUP_A(config_get_string(params, "replace"));
my_instance->source = config_copy_string(params, "source");
my_instance->user = config_copy_string(params, "user");
my_instance->source = params->get_c_str_copy("source");
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");

View File

@ -213,10 +213,10 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
{
my_instance->sessions = 0;
my_instance->topN = params->get_integer("count");
my_instance->match = config_copy_string(params, "match");
my_instance->exclude = config_copy_string(params, "exclude");
my_instance->source = config_copy_string(params, "source");
my_instance->user = config_copy_string(params, "user");
my_instance->match = params->get_c_str_copy("match");
my_instance->exclude = params->get_c_str_copy("exclude");
my_instance->source = params->get_c_str_copy("source");
my_instance->user = params->get_c_str_copy("user");
my_instance->filebase = MXS_STRDUP_A(config_get_string(params, "filebase"));
int cflags = params->get_enum("options", option_values);

View File

@ -229,8 +229,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
my_instance->query_delimiter = MXS_STRDUP_A(config_get_string(params, "query_delimiter"));
my_instance->query_delimiter_size = strlen(my_instance->query_delimiter);
my_instance->named_pipe = MXS_STRDUP_A(config_get_string(params, "named_pipe"));
my_instance->source = config_copy_string(params, "source");
my_instance->user = config_copy_string(params, "user");
my_instance->source = params->get_c_str_copy("source");
my_instance->user = params->get_c_str_copy("user");
bool error = false;

View File

@ -344,7 +344,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
inst->short_burst = params->get_integer("shortburst");
inst->long_burst = params->get_integer("longburst");
inst->burst_size = params->get_size("burstsize");
inst->binlogdir = config_copy_string(params, "binlogdir");
inst->binlogdir = params->get_c_str_copy("binlogdir");
inst->heartbeat = params->get_integer("heartbeat");
inst->retry_interval = params->get_integer("connect_retry");
inst->retry_limit = params->get_integer("master_retry_count");
@ -352,18 +352,18 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
inst->mariadb10_compat = params->get_bool("mariadb10-compatibility");
inst->maxwell_compat = params->get_bool("maxwell-compatibility");
inst->trx_safe = params->get_bool("transaction_safety");
inst->fileroot = config_copy_string(params, "filestem");
inst->fileroot = params->get_c_str_copy("filestem");
/* Server id */
inst->serverid = params->get_integer("server_id");
/* Identity options */
inst->set_master_version = config_copy_string(params, "master_version");
inst->set_master_hostname = config_copy_string(params, "master_hostname");
inst->set_slave_hostname = config_copy_string(params, "slave_hostname");
inst->set_master_version = params->get_c_str_copy("master_version");
inst->set_master_hostname = params->get_c_str_copy("master_hostname");
inst->set_slave_hostname = params->get_c_str_copy("slave_hostname");
inst->masterid = params->get_integer("master_id");
inst->set_master_server_id = inst->masterid != 0;
inst->master_uuid = config_copy_string(params, "master_uuid");
inst->master_uuid = params->get_c_str_copy("master_uuid");
inst->set_master_uuid = inst->master_uuid != NULL;
/* Slave Heartbeat */
@ -382,14 +382,13 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
/* Binlog encryption */
inst->encryption.enabled = params->get_bool("encrypt_binlog");
inst->encryption.encryption_algorithm = params->get_enum("encryption_algorithm", enc_algo_values);
inst->encryption.key_management_filename = config_copy_string(params,
"encryption_key_file");
inst->encryption.key_management_filename = params->get_c_str_copy("encryption_key_file");
/* Encryption CTX */
inst->encryption_ctx = NULL;
/* Set router uuid */
inst->uuid = config_copy_string(params, "uuid");
inst->uuid = params->get_c_str_copy("uuid");
/* Set Flat storage of binlog files as default */
inst->storage_type = BLR_BINLOG_STORAGE_FLAT;