[systemd-devel] [PATCH 2/5] libsystemd:terminal :fix uninitialized warning
David Herrmann
dh.herrmann at gmail.com
Tue Nov 4 02:34:38 PST 2014
Hi
On Mon, Nov 3, 2014 at 1:50 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Mon, 03.11.14 13:46, David Herrmann (dh.herrmann at gmail.com) wrote:
>
>> static inline int negative_errno(void) {
>> assert_return(errno > 0, -EINVAL);
>> return -errno;
>> }
>
> Looks great to me!
>
> But please add a comment next to it, explaining why to use this. I
> mean, we should really clarify that "return -errno" is usually enough,
> and "return negative_errno()" is really just about making gcc shut up,
> and should not be used for cases unlike the one you ran into.
I pushed this now. It's probably only useful for constructors, as they
don't clear the output-parameters on failure. If the return-value is
the only output-argument, there's usually no need to use it.
Thanks
David
More information about the systemd-devel
mailing list