[Dnsmasq-discuss] [PATCH] Remove tailing "white space only" lines

2020-03-07 Thread Geert Stappers
From: Geert Stappers 

Several files have  white-space-only-lines at the end.
Those strange end-of-file-markers are now removed.
---
 src/arp.c   | 2 --
 src/auth.c  | 3 ---
 src/blockdata.c | 1 -
 src/bpf.c   | 2 --
 src/cache.c | 2 --
 src/config.h| 3 ---
 src/conntrack.c | 3 ---
 src/dhcp6.c | 2 --
 src/dnsmasq.c   | 2 --
 src/forward.c   | 5 -
 src/helper.c| 3 ---
 src/inotify.c   | 1 -
 src/ip6addr.h   | 1 -
 src/lease.c | 4 
 src/netlink.c   | 2 --
 src/network.c   | 5 -
 src/radv-protocol.h | 3 ---
 src/rfc2131.c   | 7 ---
 18 files changed, 51 deletions(-)

diff --git a/src/arp.c b/src/arp.c
index 3329d6d..3f2f5be 100644
--- a/src/arp.c
+++ b/src/arp.c
@@ -230,5 +230,3 @@ int do_arp_script_run(void)
 
   return 0;
 }
-
-
diff --git a/src/auth.c b/src/auth.c
index 4daae30..cf1a2b3 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -863,6 +863,3 @@ size_t answer_auth(struct dns_header *header, char *limit, 
size_t qlen, time_t n
 }
   
 #endif  
-  
-
-
diff --git a/src/blockdata.c b/src/blockdata.c
index f33b28e..167a652 100644
--- a/src/blockdata.c
+++ b/src/blockdata.c
@@ -174,4 +174,3 @@ struct blockdata *blockdata_read(int fd, size_t len)
 {
   return blockdata_alloc_real(fd, NULL, len);
 }
-
diff --git a/src/bpf.c b/src/bpf.c
index 0ac1c8f..2b1a065 100644
--- a/src/bpf.c
+++ b/src/bpf.c
@@ -440,5 +440,3 @@ void route_sock(void)
 }
 
 #endif /* HAVE_BSD_NETWORK */
-
-
diff --git a/src/cache.c b/src/cache.c
index 30c9c41..63229cd 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1967,5 +1967,3 @@ void log_query(unsigned int flags, char *name, union 
all_addr *addr, char *arg)
   else
 my_syslog(LOG_INFO, "%s %s %s %s", source, name, verb, dest);
 }
-
- 
diff --git a/src/config.h b/src/config.h
index b002560..45971c7 100644
--- a/src/config.h
+++ b/src/config.h
@@ -438,6 +438,3 @@ static char *compile_opts =
 "dumpfile";
 
 #endif
-
-
-
diff --git a/src/conntrack.c b/src/conntrack.c
index 33f5ceb..7f20f73 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -83,6 +83,3 @@ static int callback(enum nf_conntrack_msg_type type, struct 
nf_conntrack *ct, vo
 }
 
 #endif
-  
-
-
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 096e2e1..a5de0b9 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -826,5 +826,3 @@ void dhcp_construct_contexts(time_t now)
 }
 
 #endif
-
-
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
index 10f19ea..3fb56f1 100644
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -2107,5 +2107,3 @@ int delay_dhcp(time_t start, int sec, int fd, uint32_t 
addr, unsigned short id)
   return 0;
 }
 #endif
-
- 
diff --git a/src/forward.c b/src/forward.c
index ed9c8f6..95e39e4 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -2407,8 +2407,3 @@ static unsigned short get_id(void)
   
   return ret;
 }
-
-
-
-
-
diff --git a/src/helper.c b/src/helper.c
index 7072cf4..1c64261 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -883,6 +883,3 @@ void helper_write(void)
 }
 
 #endif
-
-
-
diff --git a/src/inotify.c b/src/inotify.c
index d5804cb..ea7218a 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -295,4 +295,3 @@ int inotify_check(time_t now)
 }
 
 #endif  /* INOTIFY */
-  
diff --git a/src/ip6addr.h b/src/ip6addr.h
index 352b330..28b116e 100644
--- a/src/ip6addr.h
+++ b/src/ip6addr.h
@@ -31,4 +31,3 @@
  && ((__const uint32_t *) (a))[1] == 0\
  && ((__const uint32_t *) (a))[2] == 0\
  && ((__const uint32_t *) (a))[3] == 0)
-
diff --git a/src/lease.c b/src/lease.c
index 23e6fe0..a115b8b 100644
--- a/src/lease.c
+++ b/src/lease.c
@@ -1202,7 +1202,3 @@ void lease_add_extradata(struct dhcp_lease *lease, 
unsigned char *data, unsigned
 #endif
 
 #endif
- 
-
-  
-
diff --git a/src/netlink.c b/src/netlink.c
index d59bf62..eda4a75 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -369,5 +369,3 @@ static void nl_async(struct nlmsghdr *h)
 queue_event(EVENT_NEWADDR);
 }
 #endif
-
-  
diff --git a/src/network.c b/src/network.c
index cb956ca..fd0fd07 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1683,8 +1683,3 @@ void newaddress(time_t now)
 lease_find_interfaces(now);
 #endif
 }
-
-
-
-
-
diff --git a/src/radv-protocol.h b/src/radv-protocol.h
index edc1532..6c4ec96 100644
--- a/src/radv-protocol.h
+++ b/src/radv-protocol.h
@@ -53,6 +53,3 @@ struct prefix_opt {
 #define ICMP6_OPT_RT_INFO 24
 #define ICMP6_OPT_RDNSS   25
 #define ICMP6_OPT_DNSSL   31
-
-
-
diff --git a/src/rfc2131.c b/src/rfc2131.c
index fc54aab..c36ef9b 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -2741,10 +2741,3 @@ static void apply_delay(u32 xid, time_t recvtime, struct 
dhcp_netid *netid)
 }
 
 #endif
-  
-
-  
-  
-
-
-  
-- 
2.20.1


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] space two point eighty one, take 2

2020-03-07 Thread Geert Stappers
In-Reply-To: <1255b7ff-351f-46d7-f811-ac3373102...@thekelleys.org.uk>
On Thu, Mar 05, 2020 at 10:34:29PM +, 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
* Emptying the empty lines


To be continued.


Regards
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] space two point eighty one, (Git) alias

2020-03-07 Thread Geert Stappers
On Sat, Mar 07, 2020 at 12:21:39PM +0100, john doe wrote:
> On 3/7/2020 9:50 AM, Mark Grant wrote:
> > On Fri, 6 Mar 2020 23:38:46 +0100, Geert Stappers wrote:
> >> On Fri, Mar 06, 2020 at 02:53:43PM +, Mark Grant wrote:
> >>> On Thu, 5 Mar 2020 22:34:29 +, Simon Kelley wrote:
> 
>  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".
> 
>  I have a feeling someone once posted a solution to that, but I
>  don't have time to trawl back and find it. Can anyone help?
> 
> >>> Does
> >>>   git blame -w
> >>> do the trick?
> >>>
> >>> Mark
> >>
> >> $ git blame -w src/arp.c | head -n 15
   ...
> >> $ git blame src/arp.c | head -n 15
   ...
> >
> > Thanks. So lines 7 & 12 show the desired behaviour (ignoring
> > whitespace-only changes).
> >
> > AFAICS there is no mechanism to make this the default behaviour within
> > git. A shell alias?
> >
> 
> I would go for Git alias.
> 

Tell us more.  Do something with:
>  I have a feeling someone once posted a solution to that, but I
>  don't have time to trawl back and find it. Can anyone help?



Regards
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] space two point eighty one

2020-03-07 Thread john doe
On 3/7/2020 9:50 AM, Mark Grant wrote:
>
>
> On Fri, 6 Mar 2020 23:38:46 +0100, Geert Stappers wrote:
>
>> On Fri, Mar 06, 2020 at 02:53:43PM +, Mark Grant wrote:
>>> On Thu, 5 Mar 2020 22:34:29 +, 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:
>>
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>
> Numbers from output of `wc` increased.
>
>
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
>
> Output of `wc` is stable.
>
> At this point you probably want to do `git diff`
> and will see that trailing-space-only-lines are removed.
>
>
>> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
>
> Lines that had only spaces or tabs got that white space removed.
>
>
>> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
>> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
>
> Output of `wc` is stable.
>
> `git diff` is huge, almost 22000 lines.  Yes, a huge clean-up.
>>
>> | $ git diff | wc
>> | 21782   77039  600247
>>
>> That 21782  became the "almost 22000 lines"
>>
>
> I love to see that in the 2.81 release of dnsmasq.
>
>  git commit -am "Removed useless whitespace" --author "Geert
> Stappers "
>
>

 The obvious problem with doing that is that for ever more, when I
 run "git blame" 22000 lines will have the source "Removed useless
 whitespace".
>>
>> Euh `git diff` has "context".
>> Better numbers in another email.
>>
 I have a feeling someone once posted a solution to that, but I
 don't have time to trawl back and find it. Can anyone help?

>>> Does
>>>   git blame -w
>>> do the trick?
>>>
>>> Mark
>>
>> stappers@paddy:~/src/dnsmasq
>> $ git blame -w src/arp.c | head -n 15
>> 2a8710ac (Simon Kelley 2020-01-05 16:40:06 +   1) /* dnsmasq is
>> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
>> 2015-12-23 16:15:58 +   2) 11867dc2 (Simon Kelley 2015-12-23
>> 16:15:58 +   3)This program is free software; you can
>> redistribute it and/or modify 11867dc2 (Simon Kelley 2015-12-23
>> 16:15:58 +   4)it under the terms of the GNU General Public
>> License as published by 11867dc2 (Simon Kelley 2015-12-23 16:15:58
>> +   5)the Free Software Foundation; version 2 dated June,
>> 1991, or 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +   6)(at
>> your option) version 3 dated 29 June, 2007. 11867dc2 (Simon Kelley
>> 2015-12-23 16:15:58 +   7) 11867dc2 (Simon Kelley 2015-12-23
>> 16:15:58 +   8)This program is distributed in the hope that
>> it will be useful, 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +
>> 9)but WITHOUT ANY WARRANTY; without even the implied warranty of
>> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  10)
>> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  11)GNU General
>> Public License for more details. 11867dc2 (Simon Kelley 2015-12-23
>> 16:15:58 +  12) 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +
>> 13)You should have received a copy of the GNU General Public
>> License 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  14)
>> along with this program.  If not, see .
>> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  15) */
>> stappers@paddy:~/src/dnsmasq $ git blame src/arp.c | head -n 15
>> 2a8710ac (Simon Kelley   2020-01-05 16:40:06 +   1) /* dnsmasq is
>> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
>> 2015-12-23 16:15:58 +   2) 11867dc2 (Simon Kelley   2015-12-23
>> 16:15:58 +   3)This program is free software; you can
>> redistribute it and/or modify 11867dc2 (Simon Kelley   2015-12-23
>> 16:15:58 +   4)it under the terms of the GNU General Public
>> License as published by 11867dc2 (Simon Kelley   2015-12-23 16:15:58
>> +   5)the Free Software Foundation; version 2 dated June,
>> 1991, or 11867dc2 (Simon Kelley   2015-12-23 16:15:58 +   6)
>> (at your option) version 3 dated 29 June, 2007. e0984534 (Geert
>> Stappers 2020-03-06 23:12:53 +0100   7) 11867dc2 (Simon Kelley
>> 2015-12-23 16:15:58 +   8)This program is distributed in the
>> hope that it will be useful, 11867dc2 (Simon Kelley   2015-12-23
>> 16:15:58 

Re: [Dnsmasq-discuss] space two point eighty one

2020-03-07 Thread Mark Grant



On Fri, 6 Mar 2020 23:38:46 +0100, Geert Stappers wrote:

> On Fri, Mar 06, 2020 at 02:53:43PM +, Mark Grant wrote:
> > On Thu, 5 Mar 2020 22:34:29 +, 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:
> > > >>
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > > 
> > > > Numbers from output of `wc` increased.
> > > > 
> > > > 
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > > 
> > > > Output of `wc` is stable.
> > > > 
> > > > At this point you probably want to do `git diff`
> > > > and will see that trailing-space-only-lines are removed.
> > > > 
> > > > 
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
> > > > 
> > > > Lines that had only spaces or tabs got that white space removed.
> > > > 
> > > >  
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
> > > > 
> > > > Output of `wc` is stable.
> > > > 
> > > > `git diff` is huge, almost 22000 lines.  Yes, a huge clean-up.  
> 
> | $ git diff | wc
> | 21782   77039  600247
> 
> That 21782  became the "almost 22000 lines"
> 
> > > > 
> > > > I love to see that in the 2.81 release of dnsmasq.
> > > > 
> > > >  git commit -am "Removed useless whitespace" --author "Geert
> > > > Stappers "
> > > > 
> > > > 
> > > 
> > > The obvious problem with doing that is that for ever more, when I
> > > run "git blame" 22000 lines will have the source "Removed useless
> > > whitespace".  
> 
> Euh `git diff` has "context".
> Better numbers in another email.
> 
> > > I have a feeling someone once posted a solution to that, but I
> > > don't have time to trawl back and find it. Can anyone help?
> > >   
> > Does
> >   git blame -w
> > do the trick?
> > 
> > Mark  
> 
> stappers@paddy:~/src/dnsmasq
> $ git blame -w src/arp.c | head -n 15
> 2a8710ac (Simon Kelley 2020-01-05 16:40:06 +   1) /* dnsmasq is
> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +   2) 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +   3)This program is free software; you can
> redistribute it and/or modify 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +   4)it under the terms of the GNU General Public
> License as published by 11867dc2 (Simon Kelley 2015-12-23 16:15:58
> +   5)the Free Software Foundation; version 2 dated June,
> 1991, or 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +   6)(at
> your option) version 3 dated 29 June, 2007. 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +   7) 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +   8)This program is distributed in the hope that
> it will be useful, 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +
> 9)but WITHOUT ANY WARRANTY; without even the implied warranty of
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  10)
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  11)GNU General
> Public License for more details. 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +  12) 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +
> 13)You should have received a copy of the GNU General Public
> License 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  14)
> along with this program.  If not, see .
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +  15) */
> stappers@paddy:~/src/dnsmasq $ git blame src/arp.c | head -n 15
> 2a8710ac (Simon Kelley   2020-01-05 16:40:06 +   1) /* dnsmasq is
> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +   2) 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +   3)This program is free software; you can
> redistribute it and/or modify 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +   4)it under the terms of the GNU General Public
> License as published by 11867dc2 (Simon Kelley   2015-12-23 16:15:58
> +   5)the Free Software Foundation; version 2 dated June,
> 1991, or 11867dc2 (Simon Kelley   2015-12-23 16:15:58 +   6)
> (at your option) version 3 dated 29 June, 2007. e0984534 (Geert
> Stappers 2020-03-06 23:12:53 +0100   7) 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +   8)This program is distributed