MXS-2302: Move hint parser into its own class

Keeping the parser state internal to a subclass makes the code more
readable and allows the removal of most parameters. It also removes the
need to return iterator ranges from the tokenization function thus making
the Token class obsolete.

Unit testing benefits from this as well as it more closely resembles usage
in the wild as more of the code can be run without a live system.
This commit is contained in:
Markus Mäkelä
2019-02-18 18:14:12 +02:00
parent 3fef15e892
commit e5299e1eab
5 changed files with 199 additions and 172 deletions

View File

@ -167,15 +167,18 @@ HINT* hint_create_parameter(HINT* head, const char* pname, const char* value)
*/
void hint_free(HINT* hint)
{
if (hint->data)
if (hint)
{
MXS_FREE(hint->data);
if (hint->data)
{
MXS_FREE(hint->data);
}
if (hint->value)
{
MXS_FREE(hint->value);
}
MXS_FREE(hint);
}
if (hint->value)
{
MXS_FREE(hint->value);
}
MXS_FREE(hint);
}
bool hint_exists(HINT** p_hint,