MXS-1220: Make server JSON functions const correct
The functions now take const parameters. Also fixed a memory leak.
This commit is contained in:

committed by
Markus Mäkelä

parent
caf2172677
commit
13cba2cb75
@ -273,7 +273,7 @@ bool server_is_mxs_service(const SERVER *server);
|
|||||||
*
|
*
|
||||||
* @return JSON representation of server or NULL if an error occurred
|
* @return JSON representation of server or NULL if an error occurred
|
||||||
*/
|
*/
|
||||||
json_t* server_to_json(SERVER* server);
|
json_t* server_to_json(const SERVER* server);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert all servers into JSON format
|
* @brief Convert all servers into JSON format
|
||||||
|
@ -444,6 +444,7 @@ dprintAllServersJson(DCB *dcb)
|
|||||||
char* dump = json_dumps(all_servers, JSON_INDENT(4));
|
char* dump = json_dumps(all_servers, JSON_INDENT(4));
|
||||||
dcb_printf(dcb, "%s", dump);
|
dcb_printf(dcb, "%s", dump);
|
||||||
MXS_FREE(dump);
|
MXS_FREE(dump);
|
||||||
|
json_decref(all_servers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1394,7 +1395,7 @@ json_t* server_list_to_json()
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
json_t* server_to_json(SERVER* server)
|
json_t* server_to_json(const SERVER* server)
|
||||||
{
|
{
|
||||||
// TODO: Add error checks
|
// TODO: Add error checks
|
||||||
json_t* rval = json_object();
|
json_t* rval = json_object();
|
||||||
|
Reference in New Issue
Block a user