mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virNetlinkEventAddClient: Remove goto
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
3e00a35311
commit
22e67e4e67
@ -1114,7 +1114,8 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
|||||||
unsigned int protocol)
|
unsigned int protocol)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int r, ret = -1;
|
int r = -1;
|
||||||
|
int ret = -1;
|
||||||
virNetlinkEventSrvPrivate *srv = NULL;
|
virNetlinkEventSrvPrivate *srv = NULL;
|
||||||
|
|
||||||
if (protocol >= MAX_LINKS)
|
if (protocol >= MAX_LINKS)
|
||||||
@ -1132,14 +1133,15 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
|||||||
|
|
||||||
VIR_DEBUG("adding client: %d.", nextWatch);
|
VIR_DEBUG("adding client: %d.", nextWatch);
|
||||||
|
|
||||||
r = 0;
|
|
||||||
/* first try to re-use deleted free slots */
|
/* first try to re-use deleted free slots */
|
||||||
for (i = 0; i < srv->handlesCount; i++) {
|
for (i = 0; i < srv->handlesCount; i++) {
|
||||||
if (srv->handles[i].deleted == VIR_NETLINK_HANDLE_DELETED) {
|
if (srv->handles[i].deleted == VIR_NETLINK_HANDLE_DELETED) {
|
||||||
r = i;
|
r = i;
|
||||||
goto addentry;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r < 0) {
|
||||||
/* Resize the eventLoop array if needed */
|
/* Resize the eventLoop array if needed */
|
||||||
if (srv->handlesCount == srv->handlesAlloc) {
|
if (srv->handlesCount == srv->handlesAlloc) {
|
||||||
VIR_DEBUG("Used %zu handle slots, adding at least %d more",
|
VIR_DEBUG("Used %zu handle slots, adding at least %d more",
|
||||||
@ -1148,8 +1150,8 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
|||||||
srv->handlesCount, NETLINK_EVENT_ALLOC_EXTENT);
|
srv->handlesCount, NETLINK_EVENT_ALLOC_EXTENT);
|
||||||
}
|
}
|
||||||
r = srv->handlesCount++;
|
r = srv->handlesCount++;
|
||||||
|
}
|
||||||
|
|
||||||
addentry:
|
|
||||||
srv->handles[r].watch = nextWatch;
|
srv->handles[r].watch = nextWatch;
|
||||||
srv->handles[r].handleCB = handleCB;
|
srv->handles[r].handleCB = handleCB;
|
||||||
srv->handles[r].removeCB = removeCB;
|
srv->handles[r].removeCB = removeCB;
|
||||||
|
Loading…
Reference in New Issue
Block a user