
On 03/20/2014 12:02 PM, Solly Ross wrote:
I was wondering what the reason was for seemingly near-duplicate code. VIR_ALLOC and vshMalloc (and similar methods for calloc, etc), seem to be roughly identical in function, with the only difference being that VIR_ALLOC and friends are used in libvirt proper, whereas vshMalloc and friends are used in the virsh code. Is there a reason why virsh does not simply use VIR_ALLOC and friends?
vshMalloc calls exit() on failure, VIR_ALLOC returns NULL to the caller. libvirt.so (anything in src/) cannot call exit, but virsh is an executable not a library, so exiting is sometimes easier than dealing with failed allocations. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org