Format and clean up service.cc

Formatted sources and removed unused or unnecessary variables.
This commit is contained in:
Markus Mäkelä
2018-08-02 20:53:21 +03:00
parent 5d085f5cdf
commit 1d92eabb91

View File

@ -604,14 +604,14 @@ int service_launch_all()
MXS_NOTICE("Starting a total of %d services...", num_svc);
int curr_svc = 1;
for (Service* ptr: all_services)
for (Service* service : all_services)
{
n += (i = serviceInitialize(ptr));
MXS_NOTICE("Service '%s' started (%d/%d)", ptr->name, curr_svc++, num_svc);
n += (i = serviceInitialize(service));
MXS_NOTICE("Service '%s' started (%d/%d)", service->name, curr_svc++, num_svc);
if (i == 0)
{
MXS_ERROR("Failed to start service '%s'.", ptr->name);
MXS_ERROR("Failed to start service '%s'.", service->name);
error = true;
}
@ -1099,20 +1099,17 @@ bool service_set_filters(Service* service, const char* filters)
Service* service_internal_find(const char *name)
{
Service* service = nullptr;
Guard guard(service_spin);
for (Service* s : all_services)
{
if (strcmp(s->name, name) == 0 && atomic_load_int(&s->active))
{
service = s;
break;
return s;
}
}
return service;
return nullptr;
}
/**
@ -1155,7 +1152,6 @@ void dprintService(DCB *dcb, SERVICE *svc)
SERVER_REF *server = service->dbref;
struct tm result;
char timebuf[30];
int i;
dcb_printf(dcb, "\tService: %s\n", service->name);
dcb_printf(dcb, "\tRouter: %s\n", service->routerModule);
@ -1235,7 +1231,7 @@ dListServices(DCB *dcb)
dcb_printf(dcb, "%-25s | %-17s | #Users | Total Sessions | Backend databases\n",
"Service Name", "Router Module");
dcb_printf(dcb, "%s", HORIZ_SEPARATOR);
}
for (Service* service : all_services)
{
ss_dassert(service->stats.n_current >= 0);
@ -1263,8 +1259,6 @@ dListServices(DCB *dcb)
}
dcb_printf(dcb, "\n");
}
if (!all_services.empty())
{
dcb_printf(dcb, "%s\n", HORIZ_SEPARATOR);
}
}
@ -1274,11 +1268,8 @@ dListServices(DCB *dcb)
*
* @param dcb DCB to print the service list to.
*/
void
dListListeners(DCB *dcb)
void dListListeners(DCB *dcb)
{
SERVICE *service;
SERV_LISTENER *port;
Guard guard(service_spin);
if (!all_services.empty())
@ -1903,7 +1894,7 @@ bool service_port_is_used(unsigned short port)
bool rval = false;
Guard guard(service_spin);
for (SERVICE *service: all_services)
for (Service* service : all_services)
{
LISTENER_ITERATOR iter;