diff --git a/include/maxscale/service.h b/include/maxscale/service.h index d8192b494..81464e1fa 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -374,10 +374,9 @@ typedef enum service_version_which_t * * @param service The service. * @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, - service_version_which_t which, - uint64_t* version); +uint64_t service_get_version(const SERVICE *service, service_version_which_t which); MXS_END_DECLS diff --git a/server/core/service.cc b/server/core/service.cc index aa5266def..29d2bf49a 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -2674,10 +2674,10 @@ json_t* service_relations_to_server(const SERVER* server, const char* host) return rel; } -void service_get_version(const SERVICE *service, - service_version_which_t which, - uint64_t* version) +uint64_t service_get_version(const SERVICE *service, service_version_which_t which) { + uint64_t version = 0; + if (which == SERVICE_VERSION_ANY) { SERVER_REF* sref = service->dbref; @@ -2689,11 +2689,7 @@ void service_get_version(const SERVICE *service, if (sref) { - *version = server_get_version(sref->server); - } - else - { - *version = 0; + version = server_get_version(sref->server); } } else @@ -2750,6 +2746,8 @@ void service_get_version(const SERVICE *service, v = 0; } - *version = v; + version = v; } + + return version; }