MXS-2304 Add contains() to test if a parameter exists

Replaces uses of config_get_param() in modules either with contains()
or get_string(). The config_get_param() is moved to internal headers,
as it allows seeing inside a config setting.
This commit is contained in:
Esa Korhonen
2019-02-01 18:34:27 +02:00
parent 8e563bd0b6
commit 5ab7734e9d
11 changed files with 75 additions and 64 deletions

View File

@ -377,11 +377,10 @@ bool CacheFilter::process_params(MXS_CONFIG_PARAMETER* ppParams, CACHE_CONFIG& c
config.rules = ppParams->get_c_str_copy("rules");
const MXS_CONFIG_PARAMETER* pParam = config_get_param(ppParams, "storage_options");
if (pParam)
string storage_options = ppParams->get_string("storage_options");
if (!storage_options.empty())
{
config.storage_options = MXS_STRDUP(pParam->value);
config.storage_options = MXS_STRDUP(storage_options.c_str());
if (config.storage_options)
{

View File

@ -618,32 +618,32 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
MXS_ABORT_IF_NULL(my_instance->obj_trg);
}
MXS_CONFIG_PARAMETER* p = config_get_param(params, "logging_source_user");
std::string value = params->get_string("logging_source_user");
if (p && my_instance->src_trg)
if (!value.empty() && my_instance->src_trg)
{
my_instance->src_trg->user = parse_optstr(p->value, ",", &my_instance->src_trg->usize);
my_instance->src_trg->user = parse_optstr(value.c_str(), ",", &my_instance->src_trg->usize);
}
p = config_get_param(params, "logging_source_host");
value = params->get_string("logging_source_host");
if (p && my_instance->src_trg)
if (!value.empty() && my_instance->src_trg)
{
my_instance->src_trg->host = parse_optstr(p->value, ",", &my_instance->src_trg->hsize);
my_instance->src_trg->host = parse_optstr(value.c_str(), ",", &my_instance->src_trg->hsize);
}
p = config_get_param(params, "logging_schema");
value = params->get_string("logging_schema");
if (p && my_instance->shm_trg)
if (!value.empty() && my_instance->shm_trg)
{
my_instance->shm_trg->objects = parse_optstr(p->value, ",", &my_instance->shm_trg->size);
my_instance->shm_trg->objects = parse_optstr(value.c_str(), ",", &my_instance->shm_trg->size);
}
p = config_get_param(params, "logging_object");
value = params->get_string("logging_object");
if (p && my_instance->obj_trg)
if (!value.empty() && my_instance->obj_trg)
{
my_instance->obj_trg->objects = parse_optstr(p->value, ",", &my_instance->obj_trg->size);
my_instance->obj_trg->objects = parse_optstr(value.c_str(), ",", &my_instance->obj_trg->size);
}
my_instance->use_ssl = my_instance->ssl_client_cert