Make hint.c/hint.h const correct

Not a rigorous pass, just added const to the more obvious places.
This commit is contained in:
Esa Korhonen 2017-03-08 09:50:53 +02:00
parent f18a40ce73
commit 5c0ec3e356
2 changed files with 11 additions and 11 deletions

View File

@ -50,11 +50,11 @@ typedef struct hint
struct hint *next; /*< Another hint for this buffer */
} HINT;
extern HINT *hint_alloc(HINT_TYPE, void *, unsigned int);
extern HINT *hint_create_parameter(HINT *, char *, char *);
extern HINT *hint_create_route(HINT *, HINT_TYPE, char *);
extern void hint_free(HINT *);
extern HINT *hint_dup(HINT *);
bool hint_exists(HINT **, HINT_TYPE);
HINT *hint_alloc(HINT_TYPE, void *, unsigned int);
HINT *hint_create_parameter(HINT *, char *, const char *);
HINT *hint_create_route(HINT *, HINT_TYPE, const char *);
void hint_free(HINT *);
HINT *hint_dup(const HINT *);
bool hint_exists(HINT **, HINT_TYPE);
MXS_END_DECLS

View File

@ -38,11 +38,11 @@
* Note : Optimize this to use version numbering instead of copying memory
*/
HINT *
hint_dup(HINT *hint)
hint_dup(const HINT *hint)
{
HINT *nlhead = NULL, *nltail = NULL, *ptr1, *ptr2;
const HINT *ptr1 = hint;
HINT *nlhead = NULL, *nltail = NULL, *ptr2;
ptr1 = hint;
while (ptr1)
{
if ((ptr2 = (HINT *)MXS_MALLOC(sizeof(HINT))) == NULL)
@ -91,7 +91,7 @@ hint_dup(HINT *hint)
* @return The result hint list
*/
HINT *
hint_create_route(HINT *head, HINT_TYPE type, char *data)
hint_create_route(HINT *head, HINT_TYPE type, const char *data)
{
HINT *hint;
@ -122,7 +122,7 @@ hint_create_route(HINT *head, HINT_TYPE type, char *data)
* @return The result hint list
*/
HINT *
hint_create_parameter(HINT *head, char *pname, char *value)
hint_create_parameter(HINT *head, char *pname, const char *value)
{
HINT *hint;