[systemd-devel] [PATCH] add REMOTE_ADDR and REMOTE_PORT for Accept=yes
Lennart Poettering
lennart at poettering.net
Tue Mar 10 03:30:52 PDT 2015
On Mon, 09.03.15 23:18, Ronny Chevalier (chevalier.ronny at gmail.com) wrote:
> >> > + if (!(our_env[n_env++] =
> >> > strappend("REMOTE_ADDR=", addr))) {
> >>
> >> In newer code we try to avoid making assignments and doing if checks
> >> in the same line.
> >>
> > Taking this out would be pretty gruesome because of use of the
> > post-increment operator.
>
> Maybe by using a temporary variable like this:
>
> char *env_str;
>
> [...]
>
> env_str = strappend("REMOTE_ADDR", addr);
> if (!env_str) {
> r = -ENOMEM;
> goto fail;
> }
> our_env[n_env++] = env_str;
>
> And the same with the other one ?
Yes, I much rpefer this way. (well, except the missing "=" in the
strappend() invocation...)
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list