On Mon, 09.03.15 23:18, Ronny Chevalier (chevalier.ro...@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
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to