Re: ping: Style fixes/cleanups

2017-07-08 Thread Florian Obser
On Tue, Jul 04, 2017 at 11:24:46PM +0200, Klemens Nanni wrote: > On Tue, Jul 04, 2017 at 03:58:13PM +, Florian Obser wrote: > >I like most (all? of the correct ones), can you have another go > >at trying to fix the pointed out changes in behaviour? > > Thanks natano for pointing out these

Re: ping: Style fixes/cleanups

2017-07-05 Thread Florian Obser
On Tue, Jul 04, 2017 at 09:43:59PM +0200, Klemens Nanni wrote: > On Tue, Jul 04, 2017 at 04:00:43PM +, Florian Obser wrote: > >yeah, this is arse backwards, I'm willing to commit the oposite though, > >i.e. get rid of the void casts for printf > > Casts removed, cosecutive calls merged where

Re: ping: Style fixes/cleanups

2017-07-04 Thread Klemens Nanni
Purely cosmetic/style(9) fixes: Remove unneeded indent in prototypes, add space after return keyword. Feedback/OK? Index: ping.c === RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.220 diff -u -p -r1.220 ping.c ---

Re: ping: Style fixes/cleanups

2017-07-04 Thread Klemens Nanni
On Tue, Jul 04, 2017 at 03:58:13PM +, Florian Obser wrote: I like most (all? of the correct ones), can you have another go at trying to fix the pointed out changes in behaviour? Thanks natano for pointing out these stupid mistakes. Unify option checking, check for F_RROUTE only if

Re: ping: Style fixes/cleanups

2017-07-04 Thread Klemens Nanni
On Tue, Jul 04, 2017 at 04:00:43PM +, Florian Obser wrote: yeah, this is arse backwards, I'm willing to commit the oposite though, i.e. get rid of the void casts for printf Casts removed, cosecutive calls merged where suitable. Feedback/OK? Index: ping.c

Re: ping: Style fixes/cleanups

2017-07-04 Thread Florian Obser
yeah, this is arse backwards, I'm willing to commit the oposite though, i.e. get rid of the void casts for printf On Tue, Jun 13, 2017 at 08:12:47PM +0200, Klemens Nanni wrote: > printf's return value is ignored allmost all the times so do the same > for the rest of them as well for consistency.

Re: ping: Style fixes/cleanups

2017-07-04 Thread Florian Obser
I like most (all? of the correct ones), can you have another go at trying to fix the pointed out changes in behaviour? On Tue, Jun 13, 2017 at 08:02:13PM +0200, Klemens Nanni wrote: > Unify option checking and simply logic. > > F_HDRINCL and F_ROUTE are mutually exclusive, thus check the latter

Re: ping: Style fixes/cleanups

2017-07-04 Thread Florian Obser
commited, thanks On Tue, Jun 13, 2017 at 07:56:32PM +0200, Klemens Nanni wrote: > The intent here is to get the highest multiple of four smaller or equal > than i + 3. Instead of relying on integer division to get rid of the > remainder just to "undo" everything, simply clear the lowest two bits

Re: ping: Style fixes/cleanups

2017-07-04 Thread Florian Obser
Meh, personal taste. Also the idea is to keep AF switches to a minimum and use them as an indication that something important is going on. I'd rather just read over the memset as something boring. Maybe we are even lucky and compilers are smart enough to figure this out on their own? On Tue, Jun

Re: ping: Style fixes/cleanups

2017-07-04 Thread Florian Obser
commited, thanks! On Tue, Jun 13, 2017 at 07:48:27PM +0200, Klemens Nanni wrote: > On Tue, Jun 13, 2017 at 10:45:57AM -0600, Theo de Raadt wrote: > >Sorry, but that type of diff is a no-go. You've made a large variety > >of different decisions on your own and mixed them up with ones which > >are

Re: ping: Style fixes/cleanups

2017-06-13 Thread Martin Natano
On Tue, Jun 13, 2017 at 08:02:13PM +0200, Klemens Nanni wrote: > Unify option checking and simply logic. > > F_HDRINCL and F_ROUTE are mutually exclusive, thus check the latter only > if the former one is not set. > > Index: ping.c >

Re: ping: Style fixes/cleanups

2017-06-13 Thread Theo de Raadt
Sorry I don't see the point of (void)printf. It makes code unreadable, and only cleans up pointless false positives from tools. Any such effort is wasted. No bugs are being fixed. Imagine doing it to the entire source tree. The work would never get finished because it is largely pointless to

Re: ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
printf's return value is ignored allmost all the times so do the same for the rest of them as well for consistency. Subsequent calls got merged where I think is appropiate and readability improves. The usage format string now looks like it's actual put. Index: ping.c

Re: ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
Unify option checking and simply logic. F_HDRINCL and F_ROUTE are mutually exclusive, thus check the latter only if the former one is not set. Index: ping.c === RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.218 diff

Re: ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
The intent here is to get the highest multiple of four smaller or equal than i + 3. Instead of relying on integer division to get rid of the remainder just to "undo" everything, simply clear the lowest two bits (0b11 = 3) leaving multiples of four. Index: ping.c

Re: ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
Do not clear the unneeded dst[46] structure. Index: ping.c === RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.218 diff -u -p -r1.218 ping.c --- ping.c 22 Feb 2017 13:43:35 - 1.218 +++ ping.c 13 Jun

Re: ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
On Tue, Jun 13, 2017 at 10:45:57AM -0600, Theo de Raadt wrote: Sorry, but that type of diff is a no-go. You've made a large variety of different decisions on your own and mixed them up with ones which are personal taste, and then touched so many lines of the code that future study of historical

Re: ping: Style fixes/cleanups

2017-06-13 Thread Theo de Raadt
Sorry, but that type of diff is a no-go. You've made a large variety of different decisions on your own and mixed them up with ones which are personal taste, and then touched so many lines of the code that future study of historical changes in the code will be confusing. And you've changed the

ping: Style fixes/cleanups

2017-06-13 Thread Klemens Nanni
Ignore return status of all printf calls consistently, merge subsequent ones where appropiate, do not memset unneeded dst structure, simplify/unify option checks, use err not perror, break lines at 80 chars, remove unnecessary parentheses, avoid unobvious integer divsion, make usage format string