Re: [exim-dev] misleading indent

Top Page
Delete this message
Reply to this message
Author: Andreas Metzler
Date:  
To: exim-dev
Subject: Re: [exim-dev] misleading indent
On 2019-10-19 Jeremy Harris via Exim-dev <exim-dev@???> wrote:
> On 19/10/2019 13:26, Andreas Metzler via Exim-dev wrote:
> > gcc (correctly) warns about two instances of misleading indentation.


> Correctly? I think not. Neither is associated with a flow-control;
> they are both purely blocks for the restriction of local-variable
> scope. Your suggested changes would break function-head identification
> for editors.


Hello Jeremy,

the current indentation looks misleading to /me/. The blocks are aligned
with the preceding but uncorrelated action with "if". So I would think
that either the later blocks or the if-checks are misaligned. The diff
does not show this clearly, but look at the modified code:

---------------
if (!cipher_list)
cipher_list = ob->tls_require_ciphers;

if (tls_init(host, ob->tls_certificate, ob->tls_privatekey,
    ob->tls_sni, ob->tls_verify_certificates, ob->tls_crl,
    cipher_list, &state, tlsp, errstr) != OK)
  return FALSE;


{
int dh_min_bits = ob->tls_dh_min_bits;
if (dh_min_bits < EXIM_CLIENT_DH_MIN_MIN_BITS)
--------------

--------------
if ( buf[0] != 5
|| socks_auth(fd, buf[1], sob, tmo) != OK
)
goto proxy_err;

{
union sockaddr_46 sin;
(void) ip_addr(&sin, host_af, host->address, port);

/* send connect (ipver, ipaddr, port) */

buf[0] = 5; buf[1] = 1; buf[2] = 0; buf[3] = host_af == AF_INET6 ? 4 : 1;
--------------

Obviously /I/ am not the benchmark for "misleading" on exim code as I am
not writing the code. ;-) But still I do not get the style, indenting
code on the same syntax level (if-condition and local-variable scop
blocks) differently.

cu Andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'