mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
Use virBitmapNextClearBit in networkNextClassID
Instead of finding the next clear bit by calling virBitmapGetBit in a loop, use the virBitmapNextClearBit helper.
This commit is contained in:
parent
705242f880
commit
7b2f12fe28
@ -4672,13 +4672,11 @@ networkCheckBandwidth(virNetworkObjPtr net,
|
||||
static ssize_t
|
||||
networkNextClassID(virNetworkObjPtr net)
|
||||
{
|
||||
size_t ret = 0;
|
||||
bool is_set = false;
|
||||
ssize_t ret = 0;
|
||||
|
||||
while (virBitmapGetBit(net->class_id, ret, &is_set) == 0 && is_set)
|
||||
ret++;
|
||||
ret = virBitmapNextClearBit(net->class_id, -1);
|
||||
|
||||
if (is_set || virBitmapSetBit(net->class_id, ret) < 0)
|
||||
if (ret < 0 || virBitmapSetBit(net->class_id, ret) < 0)
|
||||
return -1;
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user