[libvirt] ignore_value

John Ferlan jferlan at redhat.com
Fri Apr 27 18:50:59 UTC 2018



On 04/27/2018 03:23 AM, gaosheng cui wrote:
> Hi,using ignore_value in libvirt source code
> to do function return value processing,but I
> can’t understand about it,can you give me some tips?thanks very much!
> 

Beyond what's stated in "gnulib/lib/ignore-value.h"?

Not sure how much more can be said - it does what it says it does -
ignores the return value. For instance, if there's a function that is
returning either NULL or some strdup'd string and will check and error
based off the return, then you have:

    ignore_value(VIR_STRDUP(target, source));
    return target;

What would be the point of indicating the VIR_STRDUP failed, then
returning to the caller and having it produce a different error message?


John

> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list