And remove NULL checking from all callers
Signed-off-by: Anya Harter <aharter(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 15 +++++----------
src/conf/object_event.c | 3 +++
src/lxc/lxc_driver.c | 24 ++++++++----------------
src/lxc/lxc_process.c | 9 +++------
src/network/bridge_driver.c | 15 +++++----------
src/node_device/node_device_udev.c | 6 ++----
src/qemu/qemu_domain.c | 3 +--
src/secret/secret_driver.c | 9 +++------
src/storage/storage_driver.c | 27 +++++++++------------------
src/test/test_driver.c | 3 ---
src/vz/vz_sdk.c | 3 +--
11 files changed, 40 insertions(+), 77 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 97e8d4eb37..9284b51783 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -566,8 +566,7 @@ bhyveDomainDefineXMLFlags(virConnectPtr conn, const char *xml,
unsigned int flag
virDomainDefFree(def);
virDomainDefFree(oldDef);
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(privconn->domainEventState, event);
+ virObjectEventStateQueue(privconn->domainEventState, event);
return dom;
}
@@ -616,8 +615,7 @@ bhyveDomainUndefine(virDomainPtr domain)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(privconn->domainEventState, event);
+ virObjectEventStateQueue(privconn->domainEventState, event);
return ret;
}
@@ -896,8 +894,7 @@ bhyveDomainCreateWithFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(privconn->domainEventState, event);
+ virObjectEventStateQueue(privconn->domainEventState, event);
return ret;
}
@@ -969,8 +966,7 @@ bhyveDomainCreateXML(virConnectPtr conn,
virObjectUnref(caps);
virDomainDefFree(def);
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(privconn->domainEventState, event);
+ virObjectEventStateQueue(privconn->domainEventState, event);
return dom;
}
@@ -1002,8 +998,7 @@ bhyveDomainDestroy(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(privconn->domainEventState, event);
+ virObjectEventStateQueue(privconn->domainEventState, event);
return ret;
}
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index 9a7e7e50c1..826197000b 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -776,6 +776,9 @@ void
virObjectEventStateQueue(virObjectEventStatePtr state,
virObjectEventPtr event)
{
+ if (!event)
+ return;
+
virObjectEventStateQueueRemote(state, event, -1);
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a2e29a2121..cfb431488d 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -499,8 +499,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned
int flags)
virDomainDefFree(def);
virDomainDefFree(oldDef);
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(caps);
virObjectUnref(cfg);
return dom;
@@ -553,8 +552,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
}
@@ -1132,8 +1130,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
virNWFilterUnlockFilterUpdates();
return ret;
@@ -1260,8 +1257,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(caps);
virObjectUnref(cfg);
virNWFilterUnlockFilterUpdates();
@@ -1516,8 +1512,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
return ret;
}
@@ -1709,8 +1704,7 @@ static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void
*opaque)
virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_DEFINED,
VIR_DOMAIN_EVENT_DEFINED_ADDED);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
}
@@ -3100,8 +3094,7 @@ static int lxcDomainSuspend(virDomainPtr dom)
virLXCDomainObjEndJob(driver, vm);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
@@ -3158,8 +3151,7 @@ static int lxcDomainResume(virDomainPtr dom)
virLXCDomainObjEndJob(driver, vm);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
virDomainObjEndAPI(&vm);
virObjectUnref(cfg);
return ret;
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index cc6ed12526..60ae7daaed 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -82,8 +82,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
if (!dom->persistent)
virDomainObjListRemove(driver->domains, dom);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
/*
@@ -692,8 +691,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
* before adding monitorCallbacks. Since we are now done with the @vm
* we can Unref/Unlock */
virDomainObjEndAPI(&vm);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED,
@@ -1607,8 +1605,7 @@ virLXCProcessAutostartDomain(virDomainObjPtr vm,
virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_BOOTED);
- if (event)
- virObjectEventStateQueue(data->driver->domainEventState, event);
+ virObjectEventStateQueue(data->driver->domainEventState, event);
}
}
virObjectUnlock(vm);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 4b33e12b30..ac849581ec 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3579,8 +3579,7 @@ networkCreateXML(virConnectPtr conn,
cleanup:
virNetworkDefFree(newDef);
- if (event)
- virObjectEventStateQueue(driver->networkEventState, event);
+ virObjectEventStateQueue(driver->networkEventState, event);
virNetworkObjEndAPI(&obj);
return net;
}
@@ -3633,8 +3632,7 @@ networkDefineXML(virConnectPtr conn,
net = virGetNetwork(conn, def->name, def->uuid);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->networkEventState, event);
+ virObjectEventStateQueue(driver->networkEventState, event);
if (freeDef)
virNetworkDefFree(def);
virNetworkObjEndAPI(&obj);
@@ -3694,8 +3692,7 @@ networkUndefine(virNetworkPtr net)
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->networkEventState, event);
+ virObjectEventStateQueue(driver->networkEventState, event);
virNetworkObjEndAPI(&obj);
return ret;
}
@@ -3905,8 +3902,7 @@ networkCreate(virNetworkPtr net)
0);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->networkEventState, event);
+ virObjectEventStateQueue(driver->networkEventState, event);
virNetworkObjEndAPI(&obj);
return ret;
}
@@ -3952,8 +3948,7 @@ networkDestroy(virNetworkPtr net)
}
cleanup:
- if (event)
- virObjectEventStateQueue(driver->networkEventState, event);
+ virObjectEventStateQueue(driver->networkEventState, event);
virNetworkObjEndAPI(&obj);
return ret;
}
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index d34ec30379..22897591de 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1297,8 +1297,7 @@ udevRemoveOneDevice(struct udev_device *device)
virNodeDeviceObjListRemove(driver->devs, obj);
virObjectUnref(obj);
- if (event)
- virObjectEventStateQueue(driver->nodeDeviceEventState, event);
+ virObjectEventStateQueue(driver->nodeDeviceEventState, event);
return 0;
}
@@ -1410,8 +1409,7 @@ udevAddOneDevice(struct udev_device *device)
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->nodeDeviceEventState, event);
+ virObjectEventStateQueue(driver->nodeDeviceEventState, event);
if (ret != 0) {
VIR_DEBUG("Discarding device %d %p %s", ret, def,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 11c261db1a..3d4e96c6bd 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -259,8 +259,7 @@ qemuDomainDisableNamespace(virDomainObjPtr vm,
void qemuDomainEventQueue(virQEMUDriverPtr driver,
virObjectEventPtr event)
{
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 02fcaece35..3c3557947e 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -278,8 +278,7 @@ secretDefineXML(virConnectPtr conn,
cleanup:
virSecretDefFree(def);
virSecretObjEndAPI(&obj);
- if (event)
- virObjectEventStateQueue(driver->secretEventState, event);
+ virObjectEventStateQueue(driver->secretEventState, event);
return ret;
}
@@ -341,8 +340,7 @@ secretSetValue(virSecretPtr secret,
cleanup:
virSecretObjEndAPI(&obj);
- if (event)
- virObjectEventStateQueue(driver->secretEventState, event);
+ virObjectEventStateQueue(driver->secretEventState, event);
return ret;
}
@@ -420,8 +418,7 @@ secretUndefine(virSecretPtr secret)
cleanup:
virSecretObjEndAPI(&obj);
- if (event)
- virObjectEventStateQueue(driver->secretEventState, event);
+ virObjectEventStateQueue(driver->secretEventState, event);
return ret;
}
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index b125e2caf9..254818e308 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -772,8 +772,7 @@ storagePoolCreateXML(virConnectPtr conn,
cleanup:
VIR_FREE(stateFile);
virStoragePoolDefFree(newDef);
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return pool;
}
@@ -829,8 +828,7 @@ storagePoolDefineXML(virConnectPtr conn,
pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolDefFree(newDef);
virStoragePoolObjEndAPI(&obj);
return pool;
@@ -889,8 +887,7 @@ storagePoolUndefine(virStoragePoolPtr pool)
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -971,8 +968,7 @@ storagePoolCreate(virStoragePoolPtr pool,
cleanup:
VIR_FREE(stateFile);
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -1016,8 +1012,7 @@ storagePoolBuild(virStoragePoolPtr pool,
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -1082,8 +1077,7 @@ storagePoolDestroy(virStoragePoolPtr pool)
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -1147,8 +1141,7 @@ storagePoolDelete(virStoragePoolPtr pool,
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -1210,8 +1203,7 @@ storagePoolRefresh(virStoragePoolPtr pool,
ret = 0;
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
return ret;
}
@@ -2301,8 +2293,7 @@ virStorageVolPoolRefreshThread(void *opaque)
event = virStoragePoolEventRefreshNew(def->name, def->uuid);
cleanup:
- if (event)
- virObjectEventStateQueue(driver->storageEventState, event);
+ virObjectEventStateQueue(driver->storageEventState, event);
virStoragePoolObjEndAPI(&obj);
virStorageVolPoolRefreshDataFree(cbdata);
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 89121d4220..eb4e5aa341 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -177,9 +177,6 @@ static void testDriverUnlock(testDriverPtr driver)
static void testObjectEventQueue(testDriverPtr driver,
virObjectEventPtr event)
{
- if (!event)
- return;
-
virObjectEventStateQueue(driver->eventState, event);
}
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index cb82b9d582..c6443d958e 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2093,8 +2093,7 @@ prlsdkSendEvent(vzDriverPtr driver,
event = virDomainEventLifecycleNewFromObj(dom,
lvEventType,
lvEventTypeDetails);
- if (event)
- virObjectEventStateQueue(driver->domainEventState, event);
+ virObjectEventStateQueue(driver->domainEventState, event);
}
static void
--
2.17.1