[PATCH 5/7] virNetworkObjNew: Remove impossible error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'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@xxxxxxxxxx>
---
 src/conf/virnetworkobj.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index ea021892c7..2a2d94dc98 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -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;
 }


-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux