[PATCH 1/3] qemuProcessStop: Set @def early

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

 



The @def variable holds pointer to the domain defintion, but is
set only somewhere in the middle of the function. This is
suboptimal.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 90ebdb43a0..8cb12ac9a6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7365,6 +7365,8 @@ void qemuProcessStop(virQEMUDriverPtr driver,
         goto endjob;
     }
 
+    def = vm->def;
+
     qemuProcessBuildDestroyMemoryPaths(driver, vm, NULL, false);
 
     if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback)
@@ -7386,7 +7388,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     virDomainConfVMNWFilterTeardown(vm);
 
     if (cfg->macFilter) {
-        def = vm->def;
         for (i = 0; i < def->nnets; i++) {
             virDomainNetDefPtr net = def->nets[i];
             if (net->ifname == NULL)
@@ -7483,7 +7484,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
 
     qemuHostdevReAttachDomainDevices(driver, vm->def);
 
-    def = vm->def;
     for (i = 0; i < def->nnets; i++) {
         virDomainNetDefPtr net = def->nets[i];
         vport = virDomainNetGetActualVirtPortProfile(net);
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[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