MXS-1249: Return service version

Since it is now a single value, the service version can be returned
as a return value instead of via an out-argument. More convenient to
use that way.
This commit is contained in:
Johan Wikman
2017-06-19 15:24:51 +03:00
parent dcfe118457
commit 33fe89772a
2 changed files with 10 additions and 13 deletions

View File

@ -374,10 +374,9 @@ typedef enum service_version_which_t
* *
* @param service The service. * @param service The service.
* @param which Which version. * @param which Which version.
* @param version On output contains the version of the service. *
* @return The version of the service.
*/ */
void service_get_version(const SERVICE *service, uint64_t service_get_version(const SERVICE *service, service_version_which_t which);
service_version_which_t which,
uint64_t* version);
MXS_END_DECLS MXS_END_DECLS

View File

@ -2674,10 +2674,10 @@ json_t* service_relations_to_server(const SERVER* server, const char* host)
return rel; return rel;
} }
void service_get_version(const SERVICE *service, uint64_t service_get_version(const SERVICE *service, service_version_which_t which)
service_version_which_t which,
uint64_t* version)
{ {
uint64_t version = 0;
if (which == SERVICE_VERSION_ANY) if (which == SERVICE_VERSION_ANY)
{ {
SERVER_REF* sref = service->dbref; SERVER_REF* sref = service->dbref;
@ -2689,11 +2689,7 @@ void service_get_version(const SERVICE *service,
if (sref) if (sref)
{ {
*version = server_get_version(sref->server); version = server_get_version(sref->server);
}
else
{
*version = 0;
} }
} }
else else
@ -2750,6 +2746,8 @@ void service_get_version(const SERVICE *service,
v = 0; v = 0;
} }
*version = v; version = v;
} }
return version;
} }