mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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 <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
51c8245847
commit
0215139bc6
@ -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) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user