
On Mon, Apr 28, 2008 at 01:43:52PM -0400, Daniel Veillard wrote:
On Mon, Apr 28, 2008 at 05:51:37PM +0100, Daniel P. Berrange wrote:
On Sun, Apr 27, 2008 at 08:29:33PM +0100, Daniel P. Berrange wrote:
After updating the virBuffer APIs to protect against improper usage I have been thinking about how we might provider safer memory allocation APIs with protection against common usage errors and compile time validation of checks for failure.
Here is an updated version which removes the bogus VIR_REALLOC function and illustrates use in capabilities.c which is a more interesting test case than hash.c
Clearly that makes for cleaner code, and more importantly safer. We should do this, possibly one module at a time, then we can try to add new syntax-check rules forbidding malloc/realloc. Also potentially we could hook up memory checks at runtime with the macro, if we need to in the future. +1 for applying this now, then we can fix one module at a time later. we don't need to grow a gigantic patch.
Ok I applied this. I'll update some more of the driver code over the course of the week. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|