This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/virstorageobj.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 108ae0aeb1..c837f96ae6 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -125,16 +125,10 @@ VIR_ONCE_GLOBAL_INIT(virStorageVolObj);
static virStorageVolObj *
virStorageVolObjNew(void)
{
- virStorageVolObj *obj;
-
if (virStorageVolObjInitialize() < 0)
return NULL;
- if (!(obj = virObjectLockableNew(virStorageVolObjClass)))
- return NULL;
-
- virObjectLock(obj);
- return obj;
+ return virObjectLockableNew(virStorageVolObjClass);
}
@@ -638,6 +632,8 @@ virStoragePoolObjAddVol(virStoragePoolObj *obj,
return -1;
}
+ virObjectLock(volobj);
+
g_hash_table_insert(volumes->objsKey, g_strdup(voldef->key), volobj);
virObjectRef(volobj);
--
2.31.1