[Dnsmasq-discuss] space two point eighty one, take 2
john doe
johndoe65534 at mail.com
Sun Mar 8 12:35:11 GMT 2020
On 3/8/2020 12:33 PM, Geert Stappers wrote:
> On Sat, Mar 07, 2020 at 10:01:30PM +0100, Geert Stappers wrote:
>> In-Reply-To: <1255b7ff-351f-46d7-f811-ac3373102662 at thekelleys.org.uk>
>> On Thu, Mar 05, 2020 at 10:34:29PM +0000, Simon Kelley wrote:
>>> On 05/03/2020 21:05, Geert Stappers wrote:
>>>> On Thu, Mar 05, 2020 at 09:46:21PM +0100, Geert Stappers wrote:
>>>>>
>>>>> I plea for removal of unneeded ' ' and ' '.
>>>>>
>>>>> That removal can be done with:
>>>>> ... remove trailing white_space_only_lines ...
>>>>>
>>>>> ... empty lines: sed --in-place -e 's/^[ \t]*$//' src/*.c ...
>>>>
>>>> I love to see that in the 2.81 release of dnsmasq.
>>>>
>>>
>>> The obvious problem with doing that is that for ever more, when I run
>> } "git blame" N lines will have the source "Removed useless whitespace".
>>
>> That valid point shouldn't be a big issue.
>> At least I think it can be mitigated.
>>
>> Now spliting previous change request into two parts:
>> * Removing trailing white_space_only_lines
>
> Done, see http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2020q1/013866.html
>
> Removed lines don't show up in `git blame`.
>
>
>> * Emptying the empty lines
>
> Execute:
>
> sed --in-place -e 's/^[ \t]*$//' src/*.c src/*.h
>
>
>
> <screenshot with="some counting and calculation">
> $ git diff | wc
> 21923 78016 607091
> $ git diff | grep ^+ | grep -c -v ^+++
> 3053
> $ wc -l src/*.c src/*.h | tail -n 1
> 39474 totaal
> $ echo "3053 / 39474 * 100" | bc -l
> 7.73420479302832244000
> </screenshot>
>
> To prevent that 8% of the lines in future `git blame`
> will distract us by reminding us on this clean-up.
>
> Execute:
>
> git commit -am "Removed useless white space" --author="Simon Kelley <simon at thekelleys.org.uk>"
>
>
> <sample>
> $ git blame src/arp.c | sed --silent -e 60,80p
> cc921df9 (Simon Kelley 2019-01-02 22:48:59 +0000 60) if (!IN6_ARE_ADDR_EQUAL(&arp->addr.addr6, (struct in6_addr *)addrp))
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 61) continue;
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 62) }
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 63)
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 64) if (arp->status == ARP_EMPTY)
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 65) {
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 66) /* existing address, was negative. */
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 67) arp->status = ARP_NEW;
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 68) arp->hwlen = maclen;
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 69) memcpy(arp->hwaddr, mac, maclen);
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 70) }
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 71) else if (arp->hwlen == maclen && memcmp(arp->hwaddr, mac, maclen) == 0)
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 72) /* Existing entry matches - confirm. */
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 73) arp->status = ARP_FOUND;
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 74) else
> 33702ab1 (Simon Kelley 2015-12-28 23:17:15 +0000 75) continue;
> ced2a733 (Simon Kelley 2020-03-08 12:17:53 +0100 76)
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 77) break;
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 78) }
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 79)
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000 80) if (!arp)
> </sample>
>
>
Please use gitsend-email as you are known to be able to use it with the
'--reroll-count=..' for a new reroll.
So Simon knows which set of patches to consider.
--
John Doe
More information about the Dnsmasq-discuss
mailing list