Add unique constraint to enumeration parameters

Enum parameters can now be declared unique. This prevents multiple values
for enumerations which only accept one value.
This commit is contained in:
Markus Mäkelä
2017-01-10 11:45:12 +02:00
parent 73a1388468
commit a1293fbd79
3 changed files with 30 additions and 1 deletions

View File

@ -3262,7 +3262,16 @@ bool config_param_is_valid(const MXS_MODULE_PARAM *params, const char *key,
break;
}
}
tok = strtok_r(NULL, delim, &endptr);
if ((params[i].options & MXS_MODULE_OPT_ENUM_UNIQUE) && (tok || !valid))
{
/** Either the only defined enum value is not valid
* or multiple values were defined */
valid = false;
break;
}
}
}
break;