MXS-1220: Make the parameters of the diagnostic entry points const

The diagnostic entry points should not modify the state of the object
being diagnosed.
This commit is contained in:
Markus Mäkelä
2017-04-19 21:56:05 +03:00
committed by Markus Mäkelä
parent c17c451fb5
commit 076599ee5e
45 changed files with 78 additions and 78 deletions

View File

@ -95,7 +95,7 @@ typedef struct mxs_authenticator
*
* @see jansson.h
*/
json_t* (*diagnostic)(struct servlistener *listener);
json_t* (*diagnostic)(const struct servlistener *listener);
/** This entry point was added to avoid calling authenticator functions
* directly when a COM_CHANGE_USER command is executed. */

View File

@ -180,7 +180,7 @@ typedef struct mxs_filter_object
*
* @see jansson.h
*/
json_t* (*diagnostics)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
json_t* (*diagnostics)(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
/**
* @brief Called to obtain the capabilities of the filter

View File

@ -145,7 +145,7 @@ public:
/**
* Called for obtaining diagnostics about the filter session.
*/
json_t* diagnostics();
json_t* diagnostics() const;
protected:
FilterSession(MXS_SESSION* pSession);
@ -272,19 +272,19 @@ public:
return rv;
}
static json_t* diagnostics(MXS_FILTER* pInstance, MXS_FILTER_SESSION* pData)
static json_t* diagnostics(const MXS_FILTER* pInstance, const MXS_FILTER_SESSION* pData)
{
json_t* rval = NULL;
if (pData)
{
FilterSessionType* pFilterSession = static_cast<FilterSessionType*>(pData);
const FilterSessionType* pFilterSession = static_cast<const FilterSessionType*>(pData);
MXS_EXCEPTION_GUARD(rval = pFilterSession->diagnostics());
}
else
{
FilterType* pFilter = static_cast<FilterType*>(pInstance);
const FilterType* pFilter = static_cast<const FilterType*>(pInstance);
MXS_EXCEPTION_GUARD(rval = pFilter->diagnostics());
}

View File

@ -154,7 +154,7 @@ typedef struct mxs_router_object
*
* @see jansson.h
*/
json_t* (*diagnostics)(MXS_ROUTER *instance);
json_t* (*diagnostics)(const MXS_ROUTER *instance);
/**
* @brief Called for each reply packet

View File

@ -173,9 +173,9 @@ public:
return rv;
}
static json_t* diagnostics(MXS_ROUTER* pInstance)
static json_t* diagnostics(const MXS_ROUTER* pInstance)
{
RouterType* pRouter = static_cast<RouterType*>(pInstance);
const RouterType* pRouter = static_cast<const RouterType*>(pInstance);
json_t* rval = NULL;

View File

@ -117,7 +117,7 @@ int users_default_loadusers(SERV_LISTENER *port);
*
* @param port Port whose data is to be printed
*/
json_t* users_default_diagnostic(SERV_LISTENER *port);
json_t* users_default_diagnostic(const SERV_LISTENER *port);
/**
* Print details of the users storage mechanism