
On Fri, Aug 10, 2007 at 03:41:54PM +0100, Richard W.M. Jones wrote:
Daniel P. Berrange wrote:
It is probably worthwhile though to ensure that we design the APIs so that the structs are always allocated by the internal driver and not the caller. This allows us to add more fields at a later date if needed.
Instead of the above, the caller has to pass in the size of the struct.
Pros to passing in the struct & size:
* New caller / old libvirt can be detected, rather than causing a segfault. * Caller is less likely to forget to free the struct (because it is mostly likely on their stack, or they explicitly malloc'd it).
Yep, that works for me. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|