---
tests/qemumonitortestutils.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b55d867..f27fc4b 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -135,15 +135,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);
- }
+ VIR_DELETE_ELEMENT(test->items, 0, test->nitems);
}
cleanup:
@@ -178,15 +170,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);
- }
+ VIR_DELETE_ELEMENT(test->items, 0, test->nitems);
}
cleanup:
@@ -405,11 +389,10 @@ qemuMonitorTestAddItem(qemuMonitorTestPtr test,
goto no_memory;
virMutexLock(&test->lock);
- if (VIR_EXPAND_N(test->items, test->nitems, 1) < 0) {
+ if (VIR_APPEND_ELEMENT(test->items, test->nitems, item) < 0) {
virMutexUnlock(&test->lock);
goto no_memory;
}
- test->items[test->nitems - 1] = item;
virMutexUnlock(&test->lock);
--
1.7.11.7