Date: Wed, 27 Dec 2023 08:48:16 -0700 From: Warner Losh <imp@bsdimp.com> To: Alexey Dokuchaev <danfe@freebsd.org> Cc: Konstantin Belousov <kostikbel@gmail.com>, Kyle Evans <kevans@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6ac7c9f06ae9 - main - daemon: remove redundant parameter from listen_child() Message-ID: <CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA@mail.gmail.com> In-Reply-To: <ZYxDXbj50bjYrxC0@FreeBSD.org> References: <202312270608.3BR688vs024888@gitrepo.freebsd.org> <ZYw5cGZAuLSbO8AW@kib.kiev.ua> <ZYxDXbj50bjYrxC0@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000dc94b3060d7fbad0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 27, 2023 at 8:31=E2=80=AFAM Alexey Dokuchaev <danfe@freebsd.org= > wrote: > On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote: > > On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote: > > > commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7 > > > > > > daemon: remove redundant parameter from listen_child() > > > > > > state already contains pipe fd > > > ... > > > @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state) > > > /* child is dead, read all until > EOF */ > > > state->pid =3D -1; > > > state->mode =3D MODE_NOCHILD; > > > - while > (listen_child(state->pipe_fd[0], > > > - state)) > > > - ; > > > + while (listen_child(state)); > > > > This line is the style regression. > > We've seen this before and I reckon these regressions would keep happenin= g > when semicolon is put on the new line by itself alone. This would be les= s > likely to happen and makes the intention more obvious to say ``continue;'= '. > fwiw, that was the recommendation of the 'old unix hands' on USENET in the mid 80s. It made the intention clear. I was told, but never encountered, that some linting tools will warn about the above style but not while (foo) continue; and so that's been my personal style ever since. I've debugged lots of code that used this style, and it's a bugger to sort out if the indentation is correct and the ; is intended at the end of the line, or if it was intended... Warner --000000000000dc94b3060d7fbad0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Wed, Dec 27, 2023 at 8:31=E2=80=AF= AM Alexey Dokuchaev <<a href=3D"mailto:danfe@freebsd.org">danfe@freebsd.= org</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x">On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote:<br> > On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote:<br> > > commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7<br> > > <br> > >=C2=A0 =C2=A0daemon: remove redundant parameter from listen_child(= )<br> > > <br> > >=C2=A0 =C2=A0state already contains pipe fd<br> > > ...<br> > > @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state)<= br> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* child = is dead, read all until EOF */<br> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0state->= ;pid =3D -1;<br> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0state->= ;mode =3D MODE_NOCHILD;<br> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while (listen= _child(state->pipe_fd[0],<br> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0state))<br> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;<br> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while (listen= _child(state));<br> > <br> > This line is the style regression.<br> <br> We've seen this before and I reckon these regressions would keep happen= ing<br> when semicolon is put on the new line by itself alone.=C2=A0 This would be = less<br> likely to happen and makes the intention more obvious to say ``continue;= 9;'.<br></blockquote><div><br></div><div>fwiw, that was the recommendat= ion of the 'old unix hands' on USENET</div><div>in the mid 80s.=C2= =A0 It made the intention clear. I was told, but never encountered,</div><d= iv>that some linting tools will warn about the above style but not while (f= oo) continue;</div><div>and so that's been my personal style ever since= . I've debugged lots of code that</div><div>used this style, and it'= ;s a bugger to sort out if the indentation is correct and the ;</div><div>i= s intended at the end of the line, or if it was intended...</div><div><br><= /div><div>Warner</div></div></div> --000000000000dc94b3060d7fbad0--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA>