[PATCHv2 11/11] test: use VIR_DELETE_ELEMENTS_N for qemuMonitorTest list

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

 



---
 tests/qemumonitortestutils.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 7133c99..bc10270 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -133,15 +133,7 @@ static int qemuMonitorTestProcessCommandJSON(qemuMonitorTestPtr test,
         ret = qemuMonitorTestAddReponse(test,
                                         test->items[0]->response);
         qemuMonitorTestItemFree(test->items[0]);
-        if (test->nitems == 1) {
-            VIR_FREE(test->items);
-            test->nitems = 0;
-        } else {
-            memmove(test->items,
-                    test->items + 1,
-                    sizeof(test->items[0]) * (test->nitems - 1));
-            VIR_SHRINK_N(test->items, test->nitems, 1);
-        }
+        ignore_value(VIR_DELETE_ELEMENTS_N(test->items, 0, test->nitems, 1));
     }
 
 cleanup:
@@ -176,15 +168,7 @@ static int qemuMonitorTestProcessCommandText(qemuMonitorTestPtr test,
         ret = qemuMonitorTestAddReponse(test,
                                         test->items[0]->response);
         qemuMonitorTestItemFree(test->items[0]);
-        if (test->nitems == 1) {
-            VIR_FREE(test->items);
-            test->nitems = 0;
-        } else {
-            memmove(test->items,
-                    test->items + 1,
-                    sizeof(test->items[0]) * (test->nitems - 1));
-            VIR_SHRINK_N(test->items, test->nitems, 1);
-        }
+        ignore_value(VIR_DELETE_ELEMENTS_N(test->items, 0, test->nitems, 1));
     }
 
 cleanup:
-- 
1.7.11.7

--
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]