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

[libvirt] [PATCH 16/17] qemu: use virDomainNetRemove instead of inline code



The code being replaced is exactly identical to the newly global
function, right down to the comment.
---
New patch in V2

 src/qemu/qemu_hotplug.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index cb41388..6119108 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2158,19 +2158,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
                         detach->ifname));
 
     networkReleaseActualDevice(detach);
-    if (vm->def->nnets > 1) {
-        memmove(vm->def->nets + i,
-                vm->def->nets + i + 1,
-                sizeof(*vm->def->nets) *
-                (vm->def->nnets - (i + 1)));
-        vm->def->nnets--;
-        if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets) < 0) {
-            /* ignore, harmless */
-        }
-    } else {
-        VIR_FREE(vm->def->nets);
-        vm->def->nnets = 0;
-    }
+    virDomainNetRemove(vm->def, i);
     virDomainNetDefFree(detach);
 
     ret = 0;
-- 
1.7.7.6


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