[netcf-devel] [PATCH] Fix build errors when using -Werror=unused-but-set-variable
Laine Stump
laine at laine.org
Wed Oct 12 18:59:10 UTC 2011
On 10/12/2011 12:56 PM, Eric Blake wrote:
> On 10/12/2011 10:01 AM, Laine Stump wrote:
>>>> - aug = get_augeas(ncf);
>>>> + get_augeas(ncf);
>>>
>>> I had to look, but it does indeed look like get_augeas is useful for
>>> its side effects of initializing a member of ncf. But are you risking
>>> a NULL dereference if the initialization failed? That is, should you
>>> be using ERR_THROW(!get_augeas(ncf), ncf, E..., "failed to get
>>> augeas") instead of blindly ignoring the return value?
>>>
>>
>> That's what the "ERR_BAIL(ncf)" immediately following get_augeas(ncf)
>> does - whenever a lower level function throws an error, it sets a flag
>> in the ncf object, so on return callers can just do "ERR_BAIL(ncf)"; if
>> an error has happened, ERR_BAIL() jumps to error;.
>
> Good. So it's not blindly ignoring things, and I can safely give:
>
> ACK.
>
Pushed. Thanks!
More information about the netcf-devel
mailing list