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 */ struct hint *next; /*< Another hint for this buffer */
} HINT; } HINT;
extern HINT *hint_alloc(HINT_TYPE, void *, unsigned int); HINT *hint_alloc(HINT_TYPE, void *, unsigned int);
extern HINT *hint_create_parameter(HINT *, char *, char *); HINT *hint_create_parameter(HINT *, char *, const char *);
extern HINT *hint_create_route(HINT *, HINT_TYPE, char *); HINT *hint_create_route(HINT *, HINT_TYPE, const char *);
extern void hint_free(HINT *); void hint_free(HINT *);
extern HINT *hint_dup(HINT *); HINT *hint_dup(const HINT *);
bool hint_exists(HINT **, HINT_TYPE); bool hint_exists(HINT **, HINT_TYPE);
MXS_END_DECLS MXS_END_DECLS

View File

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