[PATCH 05/23] util: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using virAppendElement

Michal Prívozník mprivozn at redhat.com
Thu Aug 5 15:06:03 UTC 2021


On 8/4/21 1:02 PM, Peter Krempa wrote:
> Use virAppendElement instead of virInsertElementsN to implement
> VIR_APPEND_ELEMENT_COPY which allows us to remove error handling as the
> only relevant errors were removed when switching to aborting memory
> allocation functions.
> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  src/conf/domain_conf.c           | 29 +++++------------------------
>  src/conf/nwfilter_conf.c         | 12 +++---------
>  src/conf/virnwfilterobj.c        |  8 ++------
>  src/cpu/cpu_x86.c                | 12 ++++--------
>  src/logging/log_handler.c        |  6 ++----
>  src/openvz/openvz_conf.c         |  5 ++---
>  src/qemu/qemu_domain.c           |  6 +-----
>  src/qemu/qemu_hotplug.c          |  6 ++----
>  src/util/viralloc.h              |  4 ++--
>  src/util/virfirewall.c           |  8 ++------
>  tests/nwfilterxml2firewalltest.c |  7 +------
>  11 files changed, 26 insertions(+), 77 deletions(-)

Squash this in please:

diff --git i/src/vz/vz_sdk.c w/src/vz/vz_sdk.c
index e09950812d..8a027a50b8 100644
--- i/src/vz/vz_sdk.c
+++ w/src/vz/vz_sdk.c
@@ -578,8 +578,7 @@ prlsdkAddDomainVideoInfoVm(PRL_HANDLE sdkdom, virDomainDef *def)
     video = g_new0(virDomainVideoDef, 1);
     accel = g_new0(virDomainVideoAccelDef, 1);
 
-    if (VIR_APPEND_ELEMENT_COPY(def->videos, def->nvideos, video) < 0)
-        goto error;
+    VIR_APPEND_ELEMENT_COPY(def->videos, def->nvideos, video);
 
     video->type = VIR_DOMAIN_VIDEO_TYPE_VGA;
     video->vram = videoRam << 10; /* from mbibytes to kbibytes */

Michal




More information about the libvir-list mailing list