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

Re: [libvirt] [PATCH libvirt-python 07/17] Remove use of VIR_ALLOC_N



On 09/09/2013 10:01 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> Signed-off-by: Daniel P. Berrange <berrange redhat com>
> ---
>  libvirt-override.c | 106 ++++++++++++++++++++++++++---------------------------
>  1 file changed, 53 insertions(+), 53 deletions(-)

Do we really want to make this change?  It makes maintenance harder to
reason about.  I'd lean instead towards adding a single internal header,
where we #define VIR_ALLOC_N, so that existing code can continue to use
the nicer interface (where it's harder to typo the sizeof(*var)*len).
Furthermore, VIR_ALLOC_N has bounds checking (it ensures OOM failure if
sizeof()*len would overflow) that you are losing in your rewrite.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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