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:
parent
a3c30eea3f
commit
1318e54bfc
@ -112,21 +112,16 @@ virNetworkObjNew(void)
|
|||||||
|
|
||||||
obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE);
|
obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE);
|
||||||
|
|
||||||
/* The first three class IDs are already taken */
|
/* The first three class IDs are already taken. */
|
||||||
if (virBitmapSetBitExpand(obj->classIdMap, 0) < 0 ||
|
ignore_value(virBitmapSetBit(obj->classIdMap, 0));
|
||||||
virBitmapSetBitExpand(obj->classIdMap, 1) < 0 ||
|
ignore_value(virBitmapSetBit(obj->classIdMap, 1));
|
||||||
virBitmapSetBitExpand(obj->classIdMap, 2) < 0)
|
ignore_value(virBitmapSetBit(obj->classIdMap, 2));
|
||||||
goto error;
|
|
||||||
|
|
||||||
obj->ports = virHashNew(virNetworkObjPortFree);
|
obj->ports = virHashNew(virNetworkObjPortFree);
|
||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
||||||
error:
|
|
||||||
virObjectUnref(obj);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user