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), \
|
virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
||||||
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false)
|
VIR_TYPEMATCH(ptr, &(newelem)), &(newelem), false, false)
|
||||||
#define VIR_APPEND_ELEMENT_INPLACE(ptr, count, newelem) \
|
#define VIR_APPEND_ELEMENT_INPLACE(ptr, count, newelem) \
|
||||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
virAppendElement(&(ptr), sizeof(*(ptr)), &(count), \
|
||||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||||
&(newelem), true, true))
|
&(newelem), true, true)
|
||||||
#define VIR_APPEND_ELEMENT_COPY_INPLACE(ptr, count, newelem) \
|
#define VIR_APPEND_ELEMENT_COPY_INPLACE(ptr, count, newelem) \
|
||||||
ignore_value(virInsertElementsN(&(ptr), sizeof(*(ptr)), -1, &(count), \
|
virAppendElement(&(ptr), sizeof(*(ptr)), &(count), \
|
||||||
VIR_TYPEMATCH(ptr, &(newelem)), \
|
VIR_TYPEMATCH(ptr, &(newelem)), \
|
||||||
&(newelem), false, true))
|
&(newelem), false, true)
|
||||||
|
|
||||||
/* Quiet version of macros above */
|
/* Quiet version of macros above */
|
||||||
#define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \
|
#define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user