提交 ba52e4c7 编写于 作者: M Michal Privoznik

src/rpc: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 5ab80fc1
...@@ -920,16 +920,7 @@ void virNetClientRemoveStream(virNetClientPtr client, ...@@ -920,16 +920,7 @@ void virNetClientRemoveStream(virNetClientPtr client,
if (i == client->nstreams) if (i == client->nstreams)
goto cleanup; goto cleanup;
if (client->nstreams > 1) { VIR_DELETE_ELEMENT(client->streams, i, client->nstreams);
memmove(client->streams + i,
client->streams + i + 1,
sizeof(*client->streams) *
(client->nstreams - (i + 1)));
VIR_SHRINK_N(client->streams, client->nstreams, 1);
} else {
VIR_FREE(client->streams);
client->nstreams = 0;
}
virObjectUnref(st); virObjectUnref(st);
cleanup: cleanup:
......
...@@ -1130,15 +1130,8 @@ void virNetServerRun(virNetServerPtr srv) ...@@ -1130,15 +1130,8 @@ void virNetServerRun(virNetServerPtr srv)
virNetServerClientClose(srv->clients[i]); virNetServerClientClose(srv->clients[i]);
if (virNetServerClientIsClosed(srv->clients[i])) { if (virNetServerClientIsClosed(srv->clients[i])) {
virNetServerClientPtr client = srv->clients[i]; virNetServerClientPtr client = srv->clients[i];
if (srv->nclients > 1) {
memmove(srv->clients + i, VIR_DELETE_ELEMENT(srv->clients, i, srv->nclients);
srv->clients + i + 1,
sizeof(*srv->clients) * (srv->nclients - (i + 1)));
VIR_SHRINK_N(srv->clients, srv->nclients, 1);
} else {
VIR_FREE(srv->clients);
srv->nclients = 0;
}
/* Enable services if we can accept a new client. /* Enable services if we can accept a new client.
* The new client can be accepted if we are at the limit. */ * The new client can be accepted if we are at the limit. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册