[libvirt] [PATCH 00/12] util: add VIR_(INSERT|DELETE)_ELEMENTS_N

Laine Stump laine at laine.org
Sat Oct 20 09:20:24 UTC 2012


PATCH 01/12 defines a couple new macros/functions to simplify
inserting/deleting items in the middle of an array. The remaining
patches switch over various pieces of existing code to use these new
macros rather than directly calling memmove, etc.

There are several other places where these macros could *almost* be
used, except that they use the model of pre-allocating the larger
array, then performing a bunch of operations (that may fail) and then
finally move items around in the array and adjust its count. I'm
wondering if I should add a flags arg to these to allow for specifying
a "Don't realloc" flag - when it was given, the memory allocation
operation would be presumed already done (in the case of insert) or to
be done after return (for delete). Any opinions on that?




More information about the libvir-list mailing list