diff --git a/server/modules/filter/cache/test/testrules.cc b/server/modules/filter/cache/test/testrules.cc index ab123542e..5a574932a 100644 --- a/server/modules/filter/cache/test/testrules.cc +++ b/server/modules/filter/cache/test/testrules.cc @@ -197,7 +197,7 @@ int test_store() { int errors = 0; - for (size_t i = 0; i < n_store_test_cases; ++i) + for (int i = 0; i < n_store_test_cases; ++i) { printf("TC : %d\n", (int)(i + 1)); const struct store_test_case& test_case = store_test_cases[i]; @@ -306,13 +306,28 @@ struct ARRAY_TEST_CASE const int n_array_test_cases = sizeof(array_test_cases) / sizeof(array_test_cases[0]); +typedef CacheRules::SCacheRules SCacheRules; +std::vector rules; + +struct ShouldStore +{ + ShouldStore(GWBUF* buf): + pStmt(buf) + { + } + + bool operator()(SCacheRules sRules) + { + return sRules->should_store(NULL, pStmt); + } + + GWBUF* pStmt; +}; + int test_array_store() { int errors = 0; - typedef CacheRules::SCacheRules SCacheRules; - std::vector rules; - if (CacheRules::parse(ARRAY_RULES, 0, &rules)) { for (int i = 0; i < n_array_test_cases; ++i) @@ -322,10 +337,7 @@ int test_array_store() cout << tc.zStmt << endl; GWBUF* pStmt = create_gwbuf(tc.zStmt); - auto it = std::find_if(rules.begin(), rules.end(), [pStmt](SCacheRules sRules) - { - return sRules->should_store(NULL, pStmt); - }); + auto it = std::find_if(rules.begin(), rules.end(), ShouldStore(pStmt)); int index = (it == rules.end()) ? -1 : std::distance(rules.begin(), it); diff --git a/server/modules/filter/hintfilter/hintparser.cc b/server/modules/filter/hintfilter/hintparser.cc index f4936b0a4..8b281afe8 100644 --- a/server/modules/filter/hintfilter/hintparser.cc +++ b/server/modules/filter/hintfilter/hintparser.cc @@ -31,7 +31,7 @@ /** * The keywords in the hint syntax */ -struct +static struct { const char *keyword; TOKEN_VALUE token; @@ -51,23 +51,6 @@ struct { "server", TOK_SERVER}, { NULL, static_cast(0)} }; -/** -HINT_TOKEN kwords[] = { - { TOK_MAXSCALE, "maxscale" }, - { TOK_PREPARE, "prepare" }, - { TOK_START, "start" }, - { TOK_START, "begin" }, - { TOK_STOP, "stop" }, - { TOK_STOP, "end" }, - { TOK_EQUAL, "=" }, - { TOK_ROUTE, "route" }, - { TOK_TO, "to" }, - { TOK_MASTER, "master" }, - { TOK_SLAVE, "slave" }, - { TOK_SERVER, "server" }, - { 0, NULL} -}; - */ static HINT_TOKEN *hint_next_token(GWBUF **buf, char **ptr); static void hint_pop(HINT_SESSION *);