On 02.06.2014 17:12, Eric Blake wrote:
On 06/02/2014 08:52 AM, Michal Privoznik wrote:
> Our public free functions explicitly don't accept NULL pointers
> (sigh). Therefore, callers must do something like this:
>
> if (dev)
> virNodeDeviceFree(dev);
Back-compat stinks - changing an error into silent success may break
older code that was relying on the error, so I'm not brave enough to
change the public API.
It's not our action rather than the code written that way that I'd call
broken :)
I wonder if it would be appropriate to annotate our public API with
non-NULL markers, so that at least the compiler could warn on calls to
the API with a NULL pointer.
>
> And we are not doing that on two places I've found. This leads to
> dummy error message thrown by virsh:
>
> virsh # nodedev-dumpxml nonexistent-device
> error: Could not find matching device 'nonexistent-device'
> error: invalid node device pointer in virNodeDeviceFree
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> tools/virsh-nodedev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
At any rate, whether or not we choose to make further changes to
libvirt.h, your patch is stand-alone correct. ACK.
Pushed, thanks.
Michal