MXS-2302: Use const char* in hintfilter functions
This commit is contained in:
@ -83,7 +83,7 @@ typedef struct hint
|
|||||||
} HINT;
|
} HINT;
|
||||||
|
|
||||||
HINT* hint_alloc(HINT_TYPE, void*, unsigned int);
|
HINT* hint_alloc(HINT_TYPE, void*, unsigned int);
|
||||||
HINT* hint_create_parameter(HINT*, char*, const char*);
|
HINT* hint_create_parameter(HINT*, const char*, const char*);
|
||||||
HINT* hint_create_route(HINT*, HINT_TYPE, const char*);
|
HINT* hint_create_route(HINT*, HINT_TYPE, const char*);
|
||||||
HINT* hint_splice(HINT* head, HINT* list);
|
HINT* hint_splice(HINT* head, HINT* list);
|
||||||
void hint_free(HINT*);
|
void hint_free(HINT*);
|
||||||
|
@ -145,7 +145,7 @@ HINT* hint_splice(HINT* head, HINT* list)
|
|||||||
* @param value The parameter value
|
* @param value The parameter value
|
||||||
* @return The result hint list
|
* @return The result hint list
|
||||||
*/
|
*/
|
||||||
HINT* hint_create_parameter(HINT* head, char* pname, const char* value)
|
HINT* hint_create_parameter(HINT* head, const char* pname, const char* value)
|
||||||
{
|
{
|
||||||
HINT* hint;
|
HINT* hint;
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ static struct
|
|||||||
|
|
||||||
static HINT_TOKEN* hint_next_token(GWBUF** buf, char** ptr);
|
static HINT_TOKEN* hint_next_token(GWBUF** buf, char** ptr);
|
||||||
static void hint_pop(HINT_SESSION*);
|
static void hint_pop(HINT_SESSION*);
|
||||||
static HINT* lookup_named_hint(HINT_SESSION*, char*);
|
static HINT* lookup_named_hint(HINT_SESSION*, const char*);
|
||||||
static void create_named_hint(HINT_SESSION*, char*, HINT*);
|
static void create_named_hint(HINT_SESSION*, const char*, HINT*);
|
||||||
static void hint_push(HINT_SESSION*, HINT*);
|
static void hint_push(HINT_SESSION*, HINT*);
|
||||||
static const char* token_get_keyword(HINT_TOKEN* token);
|
static const char* token_get_keyword(HINT_TOKEN* token);
|
||||||
static void token_free(HINT_TOKEN* token);
|
static void token_free(HINT_TOKEN* token);
|
||||||
@ -492,7 +492,6 @@ HINT* hint_parser(HINT_SESSION* session, GWBUF* request)
|
|||||||
/* We starting an already define set of named hints */
|
/* We starting an already define set of named hints */
|
||||||
rval = lookup_named_hint(session, hintname);
|
rval = lookup_named_hint(session, hintname);
|
||||||
hint_push(session, hint_dup(rval));
|
hint_push(session, hint_dup(rval));
|
||||||
MXS_FREE(hintname);
|
|
||||||
rval = NULL;
|
rval = NULL;
|
||||||
}
|
}
|
||||||
else if (hintname == NULL && rval == NULL)
|
else if (hintname == NULL && rval == NULL)
|
||||||
@ -529,6 +528,8 @@ HINT* hint_parser(HINT_SESSION* session, GWBUF* request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
retblock:
|
retblock:
|
||||||
|
MXS_FREE(hintname);
|
||||||
|
|
||||||
if (rval == NULL)
|
if (rval == NULL)
|
||||||
{
|
{
|
||||||
/* No new hint parsed in this statement, apply the current
|
/* No new hint parsed in this statement, apply the current
|
||||||
@ -705,7 +706,7 @@ static void hint_push(HINT_SESSION* session, HINT* hint)
|
|||||||
* @param name The name to lookup
|
* @param name The name to lookup
|
||||||
* @return the HINT or NULL if the name was not found.
|
* @return the HINT or NULL if the name was not found.
|
||||||
*/
|
*/
|
||||||
static HINT* lookup_named_hint(HINT_SESSION* session, char* name)
|
static HINT* lookup_named_hint(HINT_SESSION* session, const char* name)
|
||||||
{
|
{
|
||||||
NAMEDHINTS* ptr = session->named_hints;
|
NAMEDHINTS* ptr = session->named_hints;
|
||||||
|
|
||||||
@ -727,7 +728,7 @@ static HINT* lookup_named_hint(HINT_SESSION* session, char* name)
|
|||||||
* @param name The name of the block to ceate
|
* @param name The name of the block to ceate
|
||||||
* @param hint The hints themselves
|
* @param hint The hints themselves
|
||||||
*/
|
*/
|
||||||
static void create_named_hint(HINT_SESSION* session, char* name, HINT* hint)
|
static void create_named_hint(HINT_SESSION* session, const char* name, HINT* hint)
|
||||||
{
|
{
|
||||||
NAMEDHINTS* block;
|
NAMEDHINTS* block;
|
||||||
|
|
||||||
@ -736,7 +737,7 @@ static void create_named_hint(HINT_SESSION* session, char* name, HINT* hint)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
block->name = name;
|
block->name = MXS_STRDUP(name);
|
||||||
block->hints = hint_dup(hint);
|
block->hints = hint_dup(hint);
|
||||||
block->next = session->named_hints;
|
block->next = session->named_hints;
|
||||||
session->named_hints = block;
|
session->named_hints = block;
|
||||||
|
Reference in New Issue
Block a user