diff --git a/server/modules/filter/hintfilter/hintfilter.cc b/server/modules/filter/hintfilter/hintfilter.cc index e4fb5bd44..8cfb5aa27 100644 --- a/server/modules/filter/hintfilter/hintfilter.cc +++ b/server/modules/filter/hintfilter/hintfilter.cc @@ -119,13 +119,10 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params */ static MXS_FILTER_SESSION* newSession(MXS_FILTER* instance, MXS_SESSION* session) { - HINT_INSTANCE* my_instance = (HINT_INSTANCE*)instance; HINT_SESSION* my_session; if ((my_session = static_cast(MXS_CALLOC(1, sizeof(HINT_SESSION)))) != NULL) { - my_session->query_len = 0; - my_session->request = NULL; my_session->stack = NULL; my_session->named_hints = NULL; } @@ -146,12 +143,6 @@ static void closeSession(MXS_FILTER* instance, MXS_FILTER_SESSION* session) NAMEDHINTS* named_hints; HINTSTACK* hint_stack; - if (my_session->request) - { - gwbuf_free(my_session->request); - } - - /** Free named hints */ named_hints = my_session->named_hints; @@ -208,8 +199,6 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF* if (modutil_is_SQL(queue) && gwbuf_length(queue) > 5) { - my_session->request = NULL; - my_session->query_len = 0; process_hints(my_session, queue); } @@ -232,8 +221,6 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF* */ static void diagnostic(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb) { - HINT_INSTANCE* my_instance = (HINT_INSTANCE*)instance; - HINT_SESSION* my_session = (HINT_SESSION*)fsession; } /** diff --git a/server/modules/filter/hintfilter/hintparser.cc b/server/modules/filter/hintfilter/hintparser.cc index 2f9048716..8188faccb 100644 --- a/server/modules/filter/hintfilter/hintparser.cc +++ b/server/modules/filter/hintfilter/hintparser.cc @@ -24,6 +24,25 @@ * Code for parsing SQL comments and processing them into MaxScale hints */ +/* Parser tokens for the hint parser */ +typedef enum +{ + TOK_MAXSCALE = 1, + TOK_PREPARE, + TOK_START, + TOK_STOP, + TOK_EQUAL, + TOK_STRING, + TOK_ROUTE, + TOK_TO, + TOK_MASTER, + TOK_SLAVE, + TOK_SERVER, + TOK_LAST, + TOK_LINEBRK, + TOK_END +} TOKEN_VALUE; + /** * hint_pop - pop the hint off the top of the stack if it is not empty * diff --git a/server/modules/filter/hintfilter/mysqlhint.hh b/server/modules/filter/hintfilter/mysqlhint.hh index 9718147b3..4d1100a37 100644 --- a/server/modules/filter/hintfilter/mysqlhint.hh +++ b/server/modules/filter/hintfilter/mysqlhint.hh @@ -17,32 +17,6 @@ MXS_BEGIN_DECLS -/* Parser tokens for the hint parser */ -typedef enum -{ - TOK_MAXSCALE = 1, - TOK_PREPARE, - TOK_START, - TOK_STOP, - TOK_EQUAL, - TOK_STRING, - TOK_ROUTE, - TOK_TO, - TOK_MASTER, - TOK_SLAVE, - TOK_SERVER, - TOK_LAST, - TOK_LINEBRK, - TOK_END -} TOKEN_VALUE; - -/* The tokenising return type */ -typedef struct -{ - TOKEN_VALUE token; // The token itself - char* value; // The string version of the token -} HINT_TOKEN; - /** * A named hint set. * @@ -84,27 +58,10 @@ typedef struct typedef struct { MXS_DOWNSTREAM down; - GWBUF* request; - int query_len; HINTSTACK* stack; NAMEDHINTS* named_hints; /* The named hints defined in this session */ } HINT_SESSION; -/* Some useful macros */ -#define CURRENT_HINT(session) \ - ((session)->stack \ - ? (session)->stack->hints : NULL) - -/* Hint Parser State Machine */ -#define HS_INIT 0 -#define HS_ROUTE 1 -#define HS_ROUTE1 2 -#define HS_ROUTE_SERVER 3 -#define HS_NAME 4 -#define HS_PVALUE 5 -#define HS_PREPARE 6 - -extern HINT* hint_parser(HINT_SESSION* session, GWBUF* request); NAMEDHINTS* free_named_hint(NAMEDHINTS* named_hint); HINTSTACK* free_hint_stack(HINTSTACK* hint_stack); void process_hints(HINT_SESSION* session, GWBUF* buffer);