diff mbox

[nft,1/3] src/rule.c: don't print trailing statement whitespace

Message ID 145873749309.10004.11477358360509958985.stgit@nfdev2.cica.es
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero March 23, 2016, 12:51 p.m. UTC
This trailing whitespace is annoying when working with the textual output
of nft.

Before:

table t {
	chain c {
		ct state new
			    ^
	}
}


After:

table t {
	chain c {
		ct state new
	}
}

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 src/rule.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso March 29, 2016, 11:17 a.m. UTC | #1
On Wed, Mar 23, 2016 at 01:51:33PM +0100, Arturo Borrero Gonzalez wrote:
> This trailing whitespace is annoying when working with the textual output
> of nft.
> 
> Before:
> 
> table t {
> 	chain c {
> 		ct state new
> 			    ^
> 	}
> }
> 
> 
> After:
> 
> table t {
> 	chain c {
> 		ct state new
> 	}
> }

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/rule.c b/src/rule.c
index 85987b9..0ed7794 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -385,14 +385,15 @@  void rule_print(const struct rule *rule)
 
 	list_for_each_entry(stmt, &rule->stmts, list) {
 		stmt->ops->print(stmt);
-		printf(" ");
+		if (!list_is_last(&stmt->list, &rule->stmts))
+			printf(" ");
 	}
 
 	if (rule->comment)
-		printf("comment \"%s\" ", rule->comment);
+		printf(" comment \"%s\"", rule->comment);
 
 	if (handle_output > 0)
-		printf("# handle %" PRIu64, rule->handle.handle);
+		printf(" # handle %" PRIu64, rule->handle.handle);
 }
 
 struct scope *scope_init(struct scope *scope, const struct scope *parent)