[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] Proposal: Block device and network stats



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).

But yes, unsafe C linkage & lack of garbage collection sucks ...

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]