rpc: virnetserver: virNetServerAddService() to void

virNetServerAddService() return value is invariant, so change it
type and remove all dependent checks.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Artem Chernyshev 2024-01-04 03:16:58 +03:00 committed by Michal Privoznik
parent 46c9458654
commit bce48d99a7
4 changed files with 10 additions and 28 deletions

View File

@ -947,8 +947,7 @@ static int virLXCControllerSetupServer(virLXCController *ctrl)
if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) < 0)
goto error;
if (virNetServerAddService(srv, svc) < 0)
goto error;
virNetServerAddService(srv, svc);
g_clear_pointer(&svc, virObjectUnref);
if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_MONITOR_PROGRAM,

View File

@ -513,10 +513,7 @@ virNetServerNewPostExecRestart(virJSONValue *object,
if (!(service = virNetServerServiceNewPostExecRestart(child)))
return NULL;
if (virNetServerAddService(srv, service) < 0) {
virObjectUnref(service);
return NULL;
}
virNetServerAddService(srv, service);
}
@ -623,7 +620,7 @@ virNetServerPreExecRestart(virNetServer *srv)
}
int
void
virNetServerAddService(virNetServer *srv,
virNetServerService *svc)
{
@ -633,7 +630,6 @@ virNetServerAddService(virNetServer *srv,
srv->services[srv->nservices-1] = virObjectRef(svc);
virNetServerServiceSetDispatcher(svc, virNetServerDispatchNewClient, srv);
return 0;
}
@ -669,10 +665,7 @@ virNetServerAddServiceActivation(virNetServer *srv,
if (!svc)
return -1;
if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
virNetServerAddService(srv, svc);
}
/* Intentionally return 1 any time activation is present,
@ -723,11 +716,7 @@ virNetServerAddServiceTCP(virNetServer *srv,
nrequests_client_max)))
return -1;
if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
virNetServerAddService(srv, svc);
virObjectUnref(svc);
return 0;
@ -772,11 +761,7 @@ virNetServerAddServiceUNIX(virNetServer *srv,
nrequests_client_max)))
return -1;
if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
virNetServerAddService(srv, svc);
virObjectUnref(svc);
return 0;

View File

@ -59,8 +59,8 @@ void virNetServerShutdownWait(virNetServer *srv);
virJSONValue *virNetServerPreExecRestart(virNetServer *srv);
int virNetServerAddService(virNetServer *srv,
virNetServerService *svc);
void virNetServerAddService(virNetServer *srv,
virNetServerService *svc);
int virNetServerAddServiceTCP(virNetServer *srv,
virSystemdActivation *act,
const char *actname,

View File

@ -127,10 +127,8 @@ testCreateServer(const char *server_name, const char *host, int family)
5)))
goto error;
if (virNetServerAddService(srv, svc1) < 0)
goto error;
if (virNetServerAddService(srv, svc2) < 0)
goto error;
virNetServerAddService(srv, svc1);
virNetServerAddService(srv, svc2);
if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
goto error;