Every single call to qemuDomainEventQueue() uses the following pattern:
if (event)
qemuDomainEventQueue(driver, event);
Let's move the check for valid event to qemuDomainEventQueue and
simplify all callers.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 6 ++--
src/qemu/qemu_cgroup.c | 3 +-
src/qemu/qemu_domain.c | 6 ++--
src/qemu/qemu_driver.c | 87 ++++++++++++++++-------------------------------
src/qemu/qemu_hotplug.c | 26 ++++++--------
src/qemu/qemu_migration.c | 24 +++++--------
src/qemu/qemu_process.c | 72 +++++++++++++--------------------------
7 files changed, 78 insertions(+), 146 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 8849850..1d5b7ce 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -194,10 +194,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
"after block job", vm->def->name);
}
- if (event)
- qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event2);
virObjectUnref(cfg);
}
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 8ed74ee..733a899 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -696,8 +696,7 @@ qemuSetupCpuCgroup(virQEMUDriverPtr driver,
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
return 0;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8b050a0..6b500c1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -126,7 +126,8 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
void qemuDomainEventQueue(virQEMUDriverPtr driver,
virObjectEventPtr event)
{
- virObjectEventStateQueue(driver->domainEventState, event);
+ if (event)
+ virObjectEventStateQueue(driver->domainEventState, event);
}
@@ -2652,8 +2653,7 @@ qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver,
virDomainDiskDefFree(disk);
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ea4e545..c59834a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -976,8 +976,7 @@ static void qemuNotifyLoadDomain(virDomainObjPtr vm, int newVM, void
*opaque)
virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_DEFINED,
VIR_DOMAIN_EVENT_DEFINED_ADDED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
@@ -1791,8 +1790,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
virDomainObjEndAPI(&vm);
if (event) {
qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event2);
}
virObjectUnref(caps);
virObjectUnref(qemuCaps);
@@ -1873,8 +1871,7 @@ static int qemuDomainSuspend(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -1933,8 +1930,7 @@ static int qemuDomainResume(virDomainPtr dom)
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -2251,8 +2247,7 @@ qemuDomainDestroyFlags(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -3275,8 +3270,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
cleanup:
VIR_FREE(xml);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(caps);
return ret;
}
@@ -3777,8 +3771,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -4016,8 +4009,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_CRASHED,
VIR_DOMAIN_EVENT_CRASHED_PANICKED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockState)
< 0)
VIR_WARN("Unable to release lease on %s", vm->def->name);
@@ -4050,8 +4042,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virDomainAuditStop(vm, "destroyed");
@@ -4494,9 +4485,9 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
}
}
- if ((event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
-
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventAgentLifecycleNewFromObj(vm, newstate,
+
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL);
+ qemuDomainEventQueue(driver, event);
}
dev.data.chr->state = newstate;
@@ -5194,8 +5185,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
if (cgroup_vcpu)
virCgroupFree(&cgroup_vcpu);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virObjectUnref(cfg);
@@ -5391,8 +5381,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
cleanup:
if (cgroup_emulator)
virCgroupFree(&cgroup_emulator);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virDomainObjEndAPI(&vm);
@@ -5886,8 +5875,7 @@ qemuDomainPinIOThread(virDomainPtr dom,
cleanup:
if (cgroup_iothread)
virCgroupFree(&cgroup_iothread);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
VIR_FREE(str);
virBitmapFree(pcpumap);
virDomainObjEndAPI(&vm);
@@ -6689,8 +6677,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
VIR_DOMAIN_EVENT_STARTED,
VIR_DOMAIN_EVENT_STARTED_RESTORED);
virDomainAuditStart(vm, "restored", true);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
/* If it was running before, resume it now unless caller requested pause. */
@@ -6713,8 +6700,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
detail);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
ret = 0;
@@ -7382,8 +7368,7 @@ qemuDomainObjStart(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
}
@@ -7532,8 +7517,7 @@ static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn,
const char *xml
virDomainDefFree(oldDef);
virDomainDefFree(def);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(qemuCaps);
virObjectUnref(caps);
virObjectUnref(cfg);
@@ -7650,8 +7634,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
cleanup:
VIR_FREE(name);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -7799,8 +7782,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
* is in monitor */
virObjectEventPtr event;
event = virDomainEventDeviceAddedNewFromObj(vm, alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
if (ret == 0)
@@ -10466,8 +10448,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
eventNparams = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -13677,8 +13658,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn,
}
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -14499,8 +14479,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
virDomainAuditStop(vm, "from-snapshot");
resume = false;
thaw = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
} else if (memory && pmsuspended) {
/* qemu 1.3 is unable to save a domain in pm-suspended (S3)
* state; so we must emit an event stating that it was
@@ -14509,8 +14488,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
VIR_DOMAIN_PAUSED_FROM_SNAPSHOT);
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
ret = 0;
@@ -14523,8 +14501,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (virGetLastError() == NULL) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("resuming after snapshot failed"));
@@ -15363,8 +15340,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED,
detail);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
goto load;
}
@@ -15502,8 +15478,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
rc = qemuProcessStart(snapshot->domain->conn, driver, vm,
QEMU_ASYNC_JOB_NONE, NULL, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
@@ -15563,8 +15538,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
}
if (event) {
qemuDomainEventQueue(driver, event);
- if (event2)
- qemuDomainEventQueue(driver, event2);
+ qemuDomainEventQueue(driver, event2);
}
virDomainObjEndAPI(&vm);
virObjectUnref(caps);
@@ -17635,8 +17609,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
if (eventNparams) {
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
eventNparams = 0;
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 79338cf..5436be9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1809,8 +1809,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
}
event = virDomainEventDeviceAddedNewFromObj(vm, objalias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
/* fix the balloon size if it was set to maximum */
if (fix_balloon)
@@ -2843,8 +2842,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
virDomainAuditDisk(vm, disk->src, NULL, "detach", true);
event = virDomainEventDeviceRemovedNewFromObj(vm, disk->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->ndisks; i++) {
if (vm->def->disks[i] == disk) {
@@ -2886,8 +2884,7 @@ qemuDomainRemoveControllerDevice(virQEMUDriverPtr driver,
controller->info.alias, vm, vm->def->name);
event = virDomainEventDeviceRemovedNewFromObj(vm, controller->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->ncontrollers; i++) {
if (vm->def->controllers[i] == controller) {
@@ -2918,8 +2915,8 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
VIR_DEBUG("Removing memory device %s from domain %p %s",
mem->info.alias, vm, vm->def->name);
- if ((event = virDomainEventDeviceRemovedNewFromObj(vm, mem->info.alias)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventDeviceRemovedNewFromObj(vm, mem->info.alias);
+ qemuDomainEventQueue(driver, event);
if (virAsprintf(&backendAlias, "mem%s", mem->info.alias) < 0)
goto cleanup;
@@ -3002,8 +2999,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
}
event = virDomainEventDeviceRemovedNewFromObj(vm, hostdev->info->alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET) {
net =
hostdev->parent.data.net;
@@ -3117,8 +3113,7 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
virDomainAuditNet(vm, net, NULL, "detach", true);
event = virDomainEventDeviceRemovedNewFromObj(vm, net->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
for (i = 0; i < vm->def->nnets; i++) {
if (vm->def->nets[i] == net) {
@@ -3195,8 +3190,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
goto cleanup;
event = virDomainEventDeviceRemovedNewFromObj(vm, chr->info.alias);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuDomainChrRemove(vm->def, chr);
virDomainChrDefFree(chr);
@@ -3244,8 +3238,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
if (rc < 0)
goto cleanup;
- if ((event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias)))
- qemuDomainEventQueue(driver, event);
+ event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias);
+ qemuDomainEventQueue(driver, event);
if ((idx = virDomainRNGFind(vm->def, rng)) >= 0)
virDomainRNGRemove(vm->def, idx);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bca5ad1..ae7433e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2289,8 +2289,7 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver,
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
return ret;
@@ -3454,8 +3453,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
qemuDomainRemoveInactive(driver, vm);
}
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
virObjectUnref(caps);
virNWFilterUnlockFilterUpdates();
@@ -3803,8 +3801,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
rv = 0;
cleanup:
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return rv;
}
@@ -5330,8 +5327,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return ret;
}
@@ -5399,8 +5395,7 @@ qemuMigrationPerformPhase(virQEMUDriverPtr driver,
cleanup:
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return ret;
}
@@ -5557,8 +5552,7 @@ qemuMigrationPersist(virQEMUDriverPtr driver,
newVM ?
VIR_DOMAIN_EVENT_DEFINED_ADDED :
VIR_DOMAIN_EVENT_DEFINED_UPDATED);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
ret = 0;
@@ -5721,8 +5715,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
VIR_DOMAIN_PAUSED_USER);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
@@ -5772,8 +5765,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
qemuMonitorSetDomainLog(priv->mon, -1);
VIR_FREE(priv->origname);
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
if (orig_err) {
virSetError(orig_err);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 14d3db6..3f7a9dc 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -329,8 +329,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
cleanup:
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
}
@@ -354,8 +353,7 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
event = virDomainEventControlErrorNewFromObj(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnlock(vm);
}
@@ -518,8 +516,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -595,8 +592,7 @@ qemuProcessFakeReboot(void *opaque)
if (ret == -1)
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE));
virDomainObjEndAPI(&vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
}
@@ -645,8 +641,7 @@ qemuProcessHandleEvent(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
seconds, micros, details);
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
}
@@ -699,8 +694,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -749,8 +743,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
@@ -803,8 +796,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
unlock:
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -848,8 +840,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -910,10 +901,8 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (vm)
virObjectUnlock(vm);
- if (watchdogEvent)
- qemuDomainEventQueue(driver, watchdogEvent);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, watchdogEvent);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
@@ -974,12 +963,9 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (ioErrorEvent)
- qemuDomainEventQueue(driver, ioErrorEvent);
- if (ioErrorEvent2)
- qemuDomainEventQueue(driver, ioErrorEvent2);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, ioErrorEvent);
+ qemuDomainEventQueue(driver, ioErrorEvent2);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1102,8 +1088,7 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
event = virDomainEventGraphicsNewFromObj(vm, phase, localAddr, remoteAddr,
authScheme, subject);
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
return 0;
@@ -1162,8 +1147,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -1201,10 +1185,8 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1245,10 +1227,8 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
}
@@ -1275,8 +1255,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
virObjectUnref(cfg);
return 0;
}
@@ -1317,10 +1296,8 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon
ATTRIBUTE_UNUSED,
virObjectUnlock(vm);
- if (event)
- qemuDomainEventQueue(driver, event);
- if (lifecycleEvent)
- qemuDomainEventQueue(driver, lifecycleEvent);
+ qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, lifecycleEvent);
virObjectUnref(cfg);
return 0;
@@ -5696,8 +5673,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
dom = NULL;
}
- if (event)
- qemuDomainEventQueue(driver, event);
+ qemuDomainEventQueue(driver, event);
cleanup:
return dom;
--
2.4.5