On Sat, 10 Jan 2015 18:12:26 +0100
Lukas Slebodnik <lslebodn(a)redhat.com> wrote:
ehlo,
talloc_steal is a macro around function _talloc_steal_loc
and returns the pointer that you pass it. It does not have any
failure modes.
If the output value is ignored there are compiler warnings.
Example of warning
src/util/util.c:503:164: warning: expression result unused
[-Wunused-value] ({ __typeof__(internal_ctx) __talloc_steal_ret =
(__typeof__(internal_ctx))_talloc_steal_loc((table),(internal_ctx),
"../sssd/src/util/util.c" ":" "503"); __talloc_steal_ret;
});
^~~~~~~~~~~~~~~~~~ 1 warning generated.
I am opened to better solution of this warning.
Maybe always assign to the variable being stolen ?
I do not remember if there is any case when a steal may cause the
pointer to change (probably not) but the assignment would be safe and
the compiler can optimize it out if the variable is not used further or
internally no assignment ever happens.
Simo.
--
Simo Sorce * Red Hat, Inc * New York