1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

virNetworkObjNew: Remove impossible error handling

'obj->classIdMap' is a bitmap with size of '16', thus the first 3 bits
are guaranteed to be available. Use 'virBitmapSetBit' instead of
'virBitmapSetBitExpand' since we don't need any expansion and ignore
errors as they are impossible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
Peter Krempa 2021-07-23 10:46:40 +02:00
parent a3c30eea3f
commit 1318e54bfc

View File

@ -112,21 +112,16 @@ virNetworkObjNew(void)
obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE);
/* The first three class IDs are already taken */
if (virBitmapSetBitExpand(obj->classIdMap, 0) < 0 ||
virBitmapSetBitExpand(obj->classIdMap, 1) < 0 ||
virBitmapSetBitExpand(obj->classIdMap, 2) < 0)
goto error;
/* The first three class IDs are already taken. */
ignore_value(virBitmapSetBit(obj->classIdMap, 0));
ignore_value(virBitmapSetBit(obj->classIdMap, 1));
ignore_value(virBitmapSetBit(obj->classIdMap, 2));
obj->ports = virHashNew(virNetworkObjPortFree);
virObjectLock(obj);
return obj;
error:
virObjectUnref(obj);
return NULL;
}