netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Multiple checkpatch issues.
@ 2017-03-31 16:13 Arushi Singhal
  2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-31 16:13 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

Solved the multiple checkpatch issues.

Arushi Singhal (4):
  iptables: iptables: Add blank line after declaration
  iptables: iptables: Remove assignment in if condition
  iptables: iptables: Indent the code.
  iptables: iptables: switch and case should be at the same indent

 iptables/getethertype.c      |  4 ++-
 iptables/ip6tables-restore.c | 62 ++++++++++++++++++++++----------------------
 iptables/nft-arp.c           |  3 ++-
 iptables/xtables-arp.c       |  4 +--
 iptables/xtables-eb.c        |  4 +--
 5 files changed, 40 insertions(+), 37 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] iptables: iptables: Add blank line after declaration
  2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
@ 2017-03-31 16:13 ` Arushi Singhal
  2017-04-07 16:12   ` Pablo Neira Ayuso
  2017-03-31 16:13 ` [PATCH 2/4] iptables: iptables: Remove assignment in if condition Arushi Singhal
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Arushi Singhal @ 2017-03-31 16:13 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

Add blank line after the declaration of variable to follow kernel coding
style.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/getethertype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iptables/getethertype.c b/iptables/getethertype.c
index 027ef4a..bf3e408 100644
--- a/iptables/getethertype.c
+++ b/iptables/getethertype.c
@@ -75,6 +75,7 @@ struct ethertypeent *getethertypeent(void)
 {
 	char *e;
 	char *endptr;
+
 	register char *cp, **q;
 
 	if (etherf == NULL
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] iptables: iptables: Remove assignment in if condition
  2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
  2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
@ 2017-03-31 16:13 ` Arushi Singhal
  2017-03-31 16:13 ` [PATCH 3/4] iptables: iptables: Indent the code Arushi Singhal
  2017-03-31 16:13 ` [PATCH 4/4] iptables: iptables: switch and case should be at the same indent Arushi Singhal
  3 siblings, 0 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-31 16:13 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

Remove the assignment from if condition to follow kernel coding style
and make the code more clear and readable.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/getethertype.c | 3 ++-
 iptables/nft-arp.c      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/iptables/getethertype.c b/iptables/getethertype.c
index bf3e408..11c121a 100644
--- a/iptables/getethertype.c
+++ b/iptables/getethertype.c
@@ -84,7 +84,8 @@ struct ethertypeent *getethertypeent(void)
 	}
 
 again:
-	if ((e = fgets(line, BUFSIZ, etherf)) == NULL) {
+	e = fgets(line, BUFSIZ, etherf);
+	if (!e) {
 		return (NULL);
 	}
 	if (*e == '#')
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index 0e13b8c..37ed956 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -70,7 +70,8 @@ addr_to_network(const struct in_addr *addr)
 {
 	struct netent *net;
 
-	if ((net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET)) != NULL)
+	net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET);
+	if (net)
 		return (char *) net->n_name;
 
 	return (char *) NULL;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] iptables: iptables: Indent the code.
  2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
  2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
  2017-03-31 16:13 ` [PATCH 2/4] iptables: iptables: Remove assignment in if condition Arushi Singhal
@ 2017-03-31 16:13 ` Arushi Singhal
  2017-03-31 16:13 ` [PATCH 4/4] iptables: iptables: switch and case should be at the same indent Arushi Singhal
  3 siblings, 0 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-31 16:13 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

Ident the code.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/xtables-arp.c | 4 ++--
 iptables/xtables-eb.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c
index 6aa000a..38b0206 100644
--- a/iptables/xtables-arp.c
+++ b/iptables/xtables-arp.c
@@ -481,8 +481,8 @@ exit_printhelp(void)
 "  --set-counters PKTS BYTES	set the counter during insert/append\n"
 "[!] --version	-V		print package version.\n");
 	printf(" opcode strings: \n");
-        for (i = 0; i < NUMOPCODES; i++)
-                printf(" %d = %s\n", i + 1, opcodes[i]);
+	for (i = 0; i < NUMOPCODES; i++)
+		printf(" %d = %s\n", i + 1, opcodes[i]);
         printf(
 " hardware type string: 1 = Ethernet\n"
 " protocol type string: 0x800 = IPv4\n");
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index c8b5d4f..2cb3ae6 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -327,9 +327,9 @@ static void ebt_list_extensions(const struct xtables_target *t,
 	printf("%s v%s\n", prog_name, prog_vers);
 	printf("Loaded userspace extensions:\n");
 	/*printf("\nLoaded tables:\n");
-        while (tbl) {
+	while (tbl) {
 		printf("%s\n", tbl->name);
-                tbl = tbl->next;
+		tbl = tbl->next;
 	}*/
 	printf("\nLoaded targets:\n");
         for (t = xtables_targets; t; t = t->next) {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] iptables: iptables: switch and case should be at the same indent
  2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
                   ` (2 preceding siblings ...)
  2017-03-31 16:13 ` [PATCH 3/4] iptables: iptables: Indent the code Arushi Singhal
@ 2017-03-31 16:13 ` Arushi Singhal
  3 siblings, 0 replies; 6+ messages in thread
From: Arushi Singhal @ 2017-03-31 16:13 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

As per kernel coding style switch and case should be at the same
identation.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/ip6tables-restore.c | 62 ++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
index 8a47f09..24ea5ec 100644
--- a/iptables/ip6tables-restore.c
+++ b/iptables/ip6tables-restore.c
@@ -215,37 +215,37 @@ int ip6tables_restore_main(int argc, char *argv[])
 
 	while ((c = getopt_long(argc, argv, "bcvthnwWM:T:", options, NULL)) != -1) {
 		switch (c) {
-			case 'b':
-				fprintf(stderr, "-b/--binary option is not implemented\n");
-				break;
-			case 'c':
-				counters = 1;
-				break;
-			case 'v':
-				verbose = 1;
-				break;
-			case 't':
-				testing = 1;
-				break;
-			case 'h':
-				print_usage("ip6tables-restore",
-					    IPTABLES_VERSION);
-				break;
-			case 'n':
-				noflush = 1;
-				break;
-			case 'w':
-				wait = parse_wait_time(argc, argv);
-				break;
-			case 'W':
-				parse_wait_interval(argc, argv, &wait_interval);
-				break;
-			case 'M':
-				xtables_modprobe_program = optarg;
-				break;
-			case 'T':
-				tablename = optarg;
-				break;
+		case 'b':
+			fprintf(stderr, "-b/--binary option is not implemented\n");
+			break;
+		case 'c':
+			counters = 1;
+			break;
+		case 'v':
+			verbose = 1;
+			break;
+		case 't':
+			testing = 1;
+			break;
+		case 'h':
+			print_usage("ip6tables-restore",
+				    IPTABLES_VERSION);
+			break;
+		case 'n':
+			noflush = 1;
+			break;
+		case 'w':
+			wait = parse_wait_time(argc, argv);
+			break;
+		case 'W':
+			parse_wait_interval(argc, argv, &wait_interval);
+			break;
+		case 'M':
+			xtables_modprobe_program = optarg;
+			break;
+		case 'T':
+			tablename = optarg;
+			break;
 		}
 	}
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] iptables: iptables: Add blank line after declaration
  2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
@ 2017-04-07 16:12   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-07 16:12 UTC (permalink / raw)
  To: Arushi Singhal; +Cc: netfilter-devel

On Fri, Mar 31, 2017 at 09:43:48PM +0530, Arushi Singhal wrote:
> Add blank line after the declaration of variable to follow kernel coding
> style.
> 
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
>  iptables/getethertype.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/iptables/getethertype.c b/iptables/getethertype.c
> index 027ef4a..bf3e408 100644
> --- a/iptables/getethertype.c
> +++ b/iptables/getethertype.c
> @@ -75,6 +75,7 @@ struct ethertypeent *getethertypeent(void)
>  {
>  	char *e;
>  	char *endptr;
> +
>  	register char *cp, **q;

I don't see any need for this new empty line.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-07 16:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31 16:13 [PATCH 0/4] Multiple checkpatch issues Arushi Singhal
2017-03-31 16:13 ` [PATCH 1/4] iptables: iptables: Add blank line after declaration Arushi Singhal
2017-04-07 16:12   ` Pablo Neira Ayuso
2017-03-31 16:13 ` [PATCH 2/4] iptables: iptables: Remove assignment in if condition Arushi Singhal
2017-03-31 16:13 ` [PATCH 3/4] iptables: iptables: Indent the code Arushi Singhal
2017-03-31 16:13 ` [PATCH 4/4] iptables: iptables: switch and case should be at the same indent Arushi Singhal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).