From: Peter Krempa Date: Tue, 3 Aug 2021 12:14:20 +0000 (+0200) Subject: util: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement X-Git-Tag: v7.7.0-rc1~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0215139bc6a570450b180639ac295b71ea2de3a2;p=thirdparty%2Flibvirt.git util: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement VIR_APPEND_ELEMENT_INPLACE and VIR_APPEND_ELEMENT_COPY_INPLACE already ignore the return value from 'virInsertElementsN' which allows a trivial conversion to virAppendElement without the need for 'ignore_value'. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 7669b12e89..7397ee3771 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -237,13 +237,13 @@ int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \ VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false) #define VIR_APPEND_ELEMENT_INPLACE(ptr, count, newelem) \ - ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \ - VIR_TYPEMATCH(ptr, &(newelem)), \ - &(newelem), true, true)) + virAppendElement(&(ptr), sizeof(*(ptr)), &(count), \ + VIR_TYPEMATCH(ptr, &(newelem)), \ + &(newelem), true, true) #define VIR_APPEND_ELEMENT_COPY_INPLACE(ptr, count, newelem) \ - ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \ - VIR_TYPEMATCH(ptr, &(newelem)), \ - &(newelem), false, true)) + virAppendElement(&(ptr), sizeof(*(ptr)), &(count), \ + VIR_TYPEMATCH(ptr, &(newelem)), \ + &(newelem), false, true) /* Quiet version of macros above */ #define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \