[libvirt] [PATCHv2 00/11] util: add VIR_(INSERT|DELETE)_ELEMENTS_N

Daniel Veillard veillard at redhat.com
Wed Oct 24 04:17:54 UTC 2012


On Tue, Oct 23, 2012 at 01:46:46PM -0400, Laine Stump wrote:
> This is a repost of 
> 
>    https://www.redhat.com/archives/libvir-list/2012-October/msg01080.html
> 
> with PATCH 03/12 squashed into 01/12. There are no other changes.
> 
> ************************************
> 
> PATCH 01/11 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.

  that sounds a good idea but I'm a bit worried about the amount of
changes, so I would rather postpone that to after 1.0.0

> 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? (such as
> maybe "that's too many options!")

  That would be additional macros. An extra argument for the backing
function is not the issue IMHO rather make sure the macros name are
explicit enough that there is no confusion possible.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list