[PATCH nft 2/2] src: remove unused token_offset from struct location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This saves 8 bytes in x86_64 in struct location which is embedded in
every expression.

This shrinks struct expr to 120 bytes according to pahole.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
low hanging fruit to shrink struct expr.

 include/nftables.h | 1 -
 src/parser_bison.y | 2 --
 src/scanner.l      | 1 -
 3 files changed, 4 deletions(-)

diff --git a/include/nftables.h b/include/nftables.h
index c25deb3676dd..7d891b439a2d 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -158,7 +158,6 @@ struct location {
 	const struct input_descriptor		*indesc;
 	union {
 		struct {
-			off_t			token_offset;
 			off_t			line_offset;
 
 			unsigned int		first_line;
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 6e6f3cf8335d..6e8b639104fc 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -102,7 +102,6 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 {
 	if (n) {
 		loc->indesc       = rhs[n].indesc;
-		loc->token_offset = rhs[1].token_offset;
 		loc->line_offset  = rhs[1].line_offset;
 		loc->first_line   = rhs[1].first_line;
 		loc->first_column = rhs[1].first_column;
@@ -110,7 +109,6 @@ static void location_update(struct location *loc, struct location *rhs, int n)
 		loc->last_column  = rhs[n].last_column;
 	} else {
 		loc->indesc       = rhs[0].indesc;
-		loc->token_offset = rhs[0].token_offset;
 		loc->line_offset  = rhs[0].line_offset;
 		loc->first_line   = loc->last_line   = rhs[0].last_line;
 		loc->first_column = loc->last_column = rhs[0].last_column;
diff --git a/src/scanner.l b/src/scanner.l
index c825fa79cfd9..ecdba404b2cd 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -90,7 +90,6 @@ static void update_offset(struct parser_state *state, struct location *loc,
 			  unsigned int len)
 {
 	state->indesc->token_offset	+= len;
-	loc->token_offset		= state->indesc->token_offset;
 	loc->line_offset		= state->indesc->line_offset;
 }
 
-- 
2.30.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux