From 5c0ec3e3564b3653b58ef2e868364ae35a552c42 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 8 Mar 2017 09:50:53 +0200 Subject: [PATCH] Make hint.c/hint.h const correct Not a rigorous pass, just added const to the more obvious places. --- include/maxscale/hint.h | 12 ++++++------ server/core/hint.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/maxscale/hint.h b/include/maxscale/hint.h index 926649889..d91c3523a 100644 --- a/include/maxscale/hint.h +++ b/include/maxscale/hint.h @@ -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 diff --git a/server/core/hint.c b/server/core/hint.c index a72506903..dcb290f2b 100644 --- a/server/core/hint.c +++ b/server/core/hint.c @@ -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;